View Code of Problem 84

#include<cstdlib>
#include<cmath>
#include<cstdio>
#include<algorithm>
#include<iostream>
using namespace std;
int main(){
   char str[1000];
   int len;
   bool flag;
   while(gets(str)!=NULL)
   {
	   int j;
		len=strlen(str);
		flag=false;
		for( j=0;j<len;j++)
		{
			if((str[j]=='S'||str[j]=='s')&&(str[j+1]=='A'||str[j+1]=='a')&&(str[j+2]=='L'||str[j+2]=='l')&&(str[j+3]=='T'||str[j+3]=='t'))
			{
					flag=true;
					break;
			}
		}
		if(flag)
			printf("%s\n",str);
   }
	return 0;
}
/*
Main.cc: In function 'int main()':
Main.cc:11:10: warning: 'char* gets(char*)' is deprecated (declared at /usr/include/stdio.h:638) [-Wdeprecated-declarations]
    while(gets(str)!=NULL)
          ^
Main.cc:11:18: warning: 'char* gets(char*)' is deprecated (declared at /usr/include/stdio.h:638) [-Wdeprecated-declarations]
    while(gets(str)!=NULL)
                  ^
Main.cc:14:17: error: 'strlen' was not declared in this scope
   len=strlen(str);
                 ^
*/

Double click to view unformatted code.


Back to problem 84