// the preprocessing directives
#include <iostream> // cin, cout
#include <iomanip> // setw(n)
using namespace std;
int main()
{
int i;
cout<<"Hour Part of day"<<endl;
cout<<"================="<<endl;
for(i=0;i<=23;i++)
{
cout<<setw(2)<<i<<": ";
if(i>=0 && i<=5) // Hour range: 0 - 5
cout<< "Early moning"<<endl; // Part of day: Early moning
else if(i>=6 && i<=11) // Hour range: 6 - 11
cout<< "Moning"<<endl; // Part of day: Moning
else if(i>=12 && i<=17) // Hour range: 12 - 17
cout<< "Afternoon"<<endl; // Part of day: Afternoon
else // Hour range: 18 - 23
cout<< "Evening"<<endl; // Part of day: Evening
}
cout<<endl<<endl;
return 0;
}
Comments
Leave a comment