View Code of Problem 98

#include<stdio.h>
#include<string.h>
int main(){
	char a[200];
	char xmp[10];
	char b[120][200];
	int count = 0;
	gets(xmp);
	int flag = 0;
	while(gets(a)!=NULL){            //每一行的循环 
		char temp[200];
		int len;
		if(strcmp(a,"</xmp>")==0)
			{
				break;
			}
		if(a[0]=='<'&&a[1]=='h'&&a[2]=='3'){
			temp[200] = '\0';
			int num = 2;
			while(a[num]!='>')
				num++;
			int i,index = 0;
			for(i = num+1;a[i]!='<';i++){
				temp[index++] = a[i];
			}
		}
		else{
			if(strstr(a,"In Stock"))
				{
					flag = 1;
				}
		}
		if(flag==1){
			strcpy(b[count++],temp);
			flag = 0;
		} 
	}
	int i;
	for(i = 0;i < count; i++)
		printf("%s\n",b[i]);
	return 0;
}

Double click to view unformatted code.


Back to problem 98