Hello again:

I am having trouble declaring my variables. Can you please show me what I am doing wrong. The homework problem ask for me to use the "if" statement also, kinda having a few problems with that. Please see the question and my code below.

Thank you for your time.

Homework 3a:

Do using the if statement

Question:

Write, compile and run a C++ program named hw3a.cpp that reads in one integer that represents a total number of seconds and then breaks that number down to display the equivalent number of hours, minutes and seconds, all properly labeled.

Have your program ONLY do the calculation if the user enters a number LESS than 50,000 hours. If he enters 50,000 or more print an error message and quit.

Sample run:

Input a whole number of seconds less than 50,000:

7683

There are 2 hours, 8 minutes and 3 seconds in 7683 seconds

Sample run:

Input a whole number of seconds less than 50,000:

76099

Sorry, you were asked to enter a number less than 50,000

Source Code

```
//Variables:
//X1 = Total Number of Seconds
//X2 = Number of Minutes = X1/60
//X3 = Number of Hours = X1/360
//X4 = Number of Seconds = X3*360
//Y = 50000
#include <iostream>
using namespace std;
int main()
{
int Total Number of Seconds;
int Number of Minutes;
int Number of Hours;
int Number of Seconds;
int Y, X1, X2, X3, X4;
if (X1>Y):
cout << "What is the total number of seconds:\n";
cin >> totalnumSeconds;
cout << "What is the number of hours:\n";
cin >> numHours;
cout << "What is the number of minutes:\n";
cin >> numMinutes;
cout >> "What is the number of seconds:\n";
cin >> numSeconds;
if (X1>Y):
cout << "ERROR:" << endl;
return 0;
}
```

*Edited 5 Years Ago by Sundayy*: forgot tags