// Greet user based on the time of day
#include<iostream>
using namespace std;
int main()
{
// initialize variables
string name;
int time;
// get user's name
cout << "What is your name? ";
cin >> name;
// get time (in army time)
cout << "What time is it? ";
cin >> time;
// divide day after noon (if) or before noon (else)
if (time>1200)
// divide after noon into evening and afternoon
if (time>1800)
cout << "Good evening, " << name << endl;
else
cout << "Good afternoon, " << name << endl;
else
// divide before noon into morning and sleeping time
if (time > 500)
cout << "Good morning, " << name << endl;
else
cout << "You should be asleep\n";
return 0;
}