I am a newbie and was given an assignment by my instructor and a very brief lecture. I developed a good algorithm. Please review and see of you like what I have done so far.
Problem: Given the current time (hrs & minutes) on a 24-hr clock, add a whole # of hours and determine what the new clock reading is and how many days later it is. (Hint: Use /24 and %24, designate midnight as 0:00 hours instead of 24:00 hours, Ex - 17:30 + 37 hours is 6:30, two days later)
Here is my algorithm:
1 Prompt user for hours
2 store hours
3 prompt user for minutes
4 store minutes
5 prompt user for additional hours
6 store additional hours
7 calculate elapsed days
8 calculate new hours
9 display elapsed days
10 display new time
Oaky, I am identifying Hours, Minutes, Additional hours, and elapsed days as my variables!?
I can see that hours = 17; Minutes = 30; and Additional Hours = 37, do you agree?
I can disect a problem but I am having trouble with the code part of it.
//I figured out from reading my book how the output would be
cout << "Please enter hours:";
cin << Hours
I would appreciate any comments and direction. I will keep reading.