I can't get the message to show up in my program. You see, my program is supposed to tell you what day it is. For example;
The program will ask "Enter a day and a hour"
A stands for Saturday, so when I enter in A the cout should display Today is saturday.
Also, if someone inserts 25 for hour then the program cout will display it as "Invalid"
I'm also supposed to do this for the other days. M stands for Monday and T stands for Tuesday, S stands for Sunday and etc. Also on weekdays if someone inserts a specific time like 17, the cout should display "out at work" or something like that, but that isn't important. My current problem is that I can't get my cout to display the right message. Instead of saying "Today is Saturday" it just shows A..... Also, my time message doesn't get displayed at all.
#include <iostream.h>
int main()
{
int day, hour;
char S, M, T, W, R, F, A, Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday;
S = Sunday;
M = Monday;
T = Tuesday;
W = Wednesday;
R = Thursday;
F = Friday;
A = Saturday;
cout << "C Program 3 CSCE 1020.002" << endl
<< "Corey Jones Cjtx6362@yahoo.com" << endl << endl;
cout << "Enter the day and time." << endl << endl;
cout << "What day is it? ";
cin >> day, hour;
if ( day == 'A' && hour == 1-24) {
cout << "Today is Saturday." << endl; }
else if (day == 'A' && hour >= 25) {
cout << "Time is invalid" << endl; }
The program will ask "Enter a day and a hour"
A stands for Saturday, so when I enter in A the cout should display Today is saturday.
Also, if someone inserts 25 for hour then the program cout will display it as "Invalid"
I'm also supposed to do this for the other days. M stands for Monday and T stands for Tuesday, S stands for Sunday and etc. Also on weekdays if someone inserts a specific time like 17, the cout should display "out at work" or something like that, but that isn't important. My current problem is that I can't get my cout to display the right message. Instead of saying "Today is Saturday" it just shows A..... Also, my time message doesn't get displayed at all.
#include <iostream.h>
int main()
{
int day, hour;
char S, M, T, W, R, F, A, Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday;
S = Sunday;
M = Monday;
T = Tuesday;
W = Wednesday;
R = Thursday;
F = Friday;
A = Saturday;
cout << "C Program 3 CSCE 1020.002" << endl
<< "Corey Jones Cjtx6362@yahoo.com" << endl << endl;
cout << "Enter the day and time." << endl << endl;
cout << "What day is it? ";
cin >> day, hour;
if ( day == 'A' && hour == 1-24) {
cout << "Today is Saturday." << endl; }
else if (day == 'A' && hour >= 25) {
cout << "Time is invalid" << endl; }