View Code of Problem 89

#include <stdio.h>
#include <string.h>
using namespace std;
int main(){
	char ch[100];
	char c;
	int i=0;
	while( ~scanf("%c", &c) && c != 'Y'){
		ch[i] = c;
		i++;
	}
	ch[i] = '\0';
	for( int i=0; i<strlen(ch); i++ ){
		switch( ch[i] ){
			case 'W':printf("Wednesday\n");break;
			case 'S':
				i++;
				if( ch[i] == 'u'){
					printf("Sunday\n");
				}else if( ch[i]=='a'){
					printf("Saturday\n");
				}else{
					printf("Wrong data\n");
					i--;
				} break;
			case 'T':
				i++;
				if( ch[i] == 'u'){
					printf("Tuesday\n");
				}else if( ch[i]=='h'){
					printf("Thursday\n");
				}else{
					printf("Wrong data\n");
					i--;
				} break;
			case 'F':printf("Friday\n");break;
			case 'M':printf("Monday\n");break;
			default: printf("Wrong data\n");
		}
	}

	return 0;
	
}

/*
Main.c:3:1: error: unknown type name 'using'
 using namespace std;
 ^~~~~
Main.c:3:17: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'std'
 using namespace std;
                 ^~~
*/

Double click to view unformatted code.


Back to problem 89