Most of the test cases are passing but 5 of them are not. Here is what I am receiving in the console. This is also just 1 of 5 I am not receiving the correct output.
“1 1 1” expected output “1:1.1 !”, received “1:1.0 !”
I have tried every variation of solving this that I know and understand at my level I am new and can not seem to figure these last few out. I have tried AI and chatgpt for suggestions and other ideas of code and still is not coming out right. The code I have nos is the closest I’ve gotten to solving it. I’ve tried it with setw and setfill and setprecision and I just get an error.
Here is the code I have for output so far.
double hoursIn, minutesIn, secondsIn;
cin >> hoursIn >> minutesIn >> secondsIn;
double hoursOut, minutesOut, secondsOut;
hoursOut = hoursIn + (minutesIn / 60) + (secondsIn / 3600);
minutesOut = (hoursOut - (int)hoursOut) * 60;
secondsOut = (minutesOut - (int)minutesOut) * 60;
cout << (int)hoursOut << ":" << (int)minutesOut << "." << (int)secondsOut << " !";
}
here are the issues I am having in the console..
PASS
With input “1 1 1” expected output “1:1.1 !”, received “1:1.0 !”
PASS
PASS
PASS
PASS
With input “60.5 60 60” expected output “1:31.0 !”, received “61:30.59 !”
With input “129000.25834 100 2” expected output “1:55.32 !”, received “129001:55.32 !”
PASS
PASS
With input “60.51 60 3605” expected output “2:30.41 !”, received “62:30.40 !”
With input “10 600 24” expected output “8:0.24 !”, received “20:0.24 !”
Dillon6618 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.