#include <iostream> #include <string.h> using namespace std; int main(){ char s[1000]; gets(s); int len = strlen(s); for(int j=0;j<len;j++){ if(s[j]=='W') printf("Wednesday\n"); else if(s[j]=='M'); printf("Monday\n"); else if(s[j]=='F'); printf("Friday\n"); else if(s[j]=='T'&&s[j+1]=='u'){ printf("Tuesday\n"); j++; } else if(s[j]=='T'&&s[j+1]=='h'){ printf("Thursday\n"); j++; } else if(s[j]=='S'&&s[j+1]=='a'){ printf("Saturday\n"); j++; } else if(s[j]=='S'&&s[j+1]=='u'){ printf("Sunday\n"); j++; } else if(s[j]=='Y') break; else printf("Wrong data\n"); } return 0; } /* Main.cc: In function 'int main()': Main.cc:7:3: warning: 'char* gets(char*)' is deprecated (declared at /usr/include/stdio.h:638) [-Wdeprecated-declarations] gets(s); ^ Main.cc:7:9: warning: 'char* gets(char*)' is deprecated (declared at /usr/include/stdio.h:638) [-Wdeprecated-declarations] gets(s); ^ Main.cc:14:5: error: 'else' without a previous 'if' else if(s[j]=='F'); ^ Main.cc:16:5: error: 'else' without a previous 'if' else if(s[j]=='T'&&s[j+1]=='u'){ ^ */ |
Double click to view unformatted code.