View Code of Problem 98

#include <iostream>
#include <string.h>
using namespace std;

int main(){
	string h3;
	string name;
	string li;
	int flag=0;
	int count = 0; 
	while(getline(cin,h3)){
		if(h3!="<xmp>"&&h3!="</xmp>"){
			int start = h3.find('>');
			int end = h3.rfind('<');
			name = h3.substr(start+1,end-start-1);
			int x=4;
			while(x--){
				getline(cin,li);
				if(li.find("In Stock")!=li.npos){
					flag=1;
				}
			}
			if(flag){
				cout<<name<<endl;
			}
			flag=0;
		}
	}
}

Double click to view unformatted code.


Back to problem 98