I want to let everyone know this is not homework (as this is only my 4th chapter in this book and if it was homework this program would not be at the end of a semester since it in in May). I am trying to learn C++ on my own and have two questions. My first question is the following code returns the startTime and say for example I hit 7 for my start time I need it to return 07.00 for my start time and it currently returns 7.00.
1 2 3 4 5
//Show results
cout << fixed << showpoint << setprecision(2);
cout << "\nThe start time of the call was " << startTime << endl;
My second question is I need to set the minutes to not go above 59. I know how, for example, how to get the entire 23.59 to not go above .59 but not just the minutes. I am guessing I need to break the start time up into hour and minutes but not sure how to do that.
I also want to add this chapter is just if statements and next chapter is the actual looping so I dont want to do anything that isnt covered in the book up to this point (find something using ceil but it is not covered in the book yet).
Hey rich thanks for the help. I just want to make sure I understand the first code snippet you sent for future reference.
[code]
(startTime - (int)startTime) > 0.59)
[/code
If I am reading this right this is a cast that subtracts the double start time by just the integer part of the start time and leaving the decimal as is?