Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Include the Option for English, French, Spanish-- I am unsure how to do this Mak

ID: 3602027 • Letter: I

Question

Include the Option for English, French, Spanish-- I am unsure how to do this

Make a function TimeToGreeting that takes in time as a parameter and prints Good Morning, Afternoon, Evening... Complete by next class (Monday). Stretch goal: modify TimeToGreeting to include a character to indicate the language (e.g. 'E' -English, S- Spanish, 'F' - French. (you can used Google translate to get the proper equivalent, or just say "French version of Good Morning What is your name? Joe What time is it? 0900 Good morning, Joe. >timeGreetings What is your name? Laura What time is it? 1400 Good afternoon, Laura.

Explanation / Answer

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
char* TimeToGreeting(int time)
{
if (time>=400 && time<=1159)
return "Good Morning, ";
else if(time>=1200 && time<=1659)
return "Good Afternoon, ";
else if(time>=1700 && time<=2359)
return "Good Evening, ";
else
return "Good Night, ";
}

int main()
{
char name[20];
int time;
printf("What is your name? ");
scanf("%s",name); fflush(stdin);

printf("What time is it? ");

scanf("%d",&time);
printf(" %s%s",TimeToGreeting(time));
return 0;
}