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

Make a function TimeToGreeting that takes in time as a parameter and prints Good

ID: 3605099 • Letter: M

Question

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<iostream>
#include<string.h>
#include<string>
#include<stdlib.h>

using namespace std;


int main(){

   string name;
   string time;
   int n;

   cout << "What is your name?";
   cin >> name;
   cout << "What time is it?";
   cin >> time;
   n = atoi(time.c_str());
   if (n < 1200 && n > 500){
      cout << "E-Good Morining, " << name << endl;
      cout << "F-Bonjour, " << name << endl;
      cout << "S-BUENOS DÍAS, " << name << endl;

   }
   if (n < 1600 && n >= 1200){
      cout << "E-Good afternoon, " << name << endl;
      cout << "F-bonne après-midi, " << name << endl;
      cout << "S-Buenas tardes, " << name << endl;
   }
   if (n >= 1600 && n > 2000){
      cout << "E-Good evening, " << name << endl;
      cout << "F-Bonsoir, " << name << endl;
      cout << "S-Buena noches, " << name << endl;
   }
   if ((n >= 2000 && n <= 2300) || (n < 500 )){
      cout << "E-Good night, " << name << endl;
      cout << "F-Bonne nuit, " << name << endl;
      cout << "S-Buenas noches, " << name << endl;
   }
   return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote