Hi Guys:
I have completed my source code for the following problem using the "if" statement. I have gotten 4 errors which are:
Line|26|error: ambiguous overload for 'operator>>' in 'std::cin >> (Total_Number_of_Seconds / 3600)'|
Line|29|error: ambiguous overload for 'operator>>' in 'std::cin >> (Total_Number_of_Seconds % 3600)'|
Line|32|error: ambiguous overload for 'operator>>' in 'std::cin >> (Remainder / 60)'|
Line|35|error: ambiguous overload for 'operator>>' in 'std::cin >> (Remainder % 60)'|
Can someone please tell me how to fix. I am attaching the homework question and the code.
Thank You in advance.
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
CODE
//Variables:
//Total_Number_of_Seconds=50000
//Hours = Total_Numbers_of_Seconds/3600
//Remainder = Total_Number_of_Seconds%3600
//Minutes = Remainder/60
//Seconds = Remainder%60
#include <iostream>
using namespace std;
int main()
{
int Total_Number_of_Seconds;
int Hours=Total_Number_of_Seconds/3600;
int Remainder=Total_Number_of_Seconds%3600;
int Minutes=Remainder/60;
int Seconds=Remainder%60;
if (Total_Number_of_Seconds<50000);
cout << "What is Total_Number_of_Seconds:\n";
cin >> Total_Number_of_Seconds;
cout << "What is Hours:\n";
cin >> Total_Number_of_Seconds/3600;
cout << "What is Remainder:\n";
cin >> Total_Number_of_Seconds%3600;
cout << "What is Minutes:\n";
cin >> Remainder/60;
cout << "What is Seconds:\n";
cin >> Remainder%60;
if (Total_Number_of_Seconds>50000);
cout << "ERROR:" << endl;
return 0;
}