View Code of Problem 89

#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;
}

Double click to view unformatted code.


Back to problem 89