View Code of Problem 89

#include<iostream>
#include<string>
#include<stdio.h>
#include<string.h>
#include<stdio.h>
int a=0;
int main()
{
	char str[100];

	for(a=0;a<100;a++)
	{
		scanf("%c",&str[a]);
		if(str[a]=='Y')
			break;
	}
	str[a]='\0';
//	printf("%d",a);
	for(int i=0;i<strlen(str);i++)
	{
		if(str[i]=='W')
		{
			printf("Wednesday\n");
		}
		else if(str[i]=='S')
		{
			if(str[i+1]=='a')
			{
				printf("Saturday\n");
				i++;
			}
			else if(str[i+1]=='u')
			{
				printf("Sunday\n");
				i++;
			}
			else{
				printf("Wrong data\n");
			}
		}
		else if(str[i]=='T')
		{	if(str[i+1]=='u')
			{
				printf("Tuesday\n");
				i++;
			}
			else if(str[i+1]=='h')
			{
				printf("Thursday\n");
				i++;
			}
			else{
				printf("Wrong data\n");
			}
		}
		else if(str[i]=='F')
		{
			printf("Friday\n");
		}
		else
		{
			printf("Wrong data\n");
		}
	}
	system("pause");
}

Double click to view unformatted code.


Back to problem 89