| jsnookiii (8) | |
| I am having trouble trying to get a loop to display every combination of hours, minutes, and seconds there are in a day. I can get it to count the first 60 seconds but after that it just exits. It needs to be in HH:MM:SS format like 23:59:59. But I'm not really sure where to start. Please help this poor noob. | |
|
|
|
| Felicia123 (156) | |
| show what you done so far and so that we can help | |
|
|
|
| jsnookiii (8) | |
|
int main() { //variables int hour = 0, minute = 00, second =00; bool done, hdone, mdone, sdone; //loop to get all combos done = (hour == 24) && ( minute== 00) && (second == 00); sdone= (second == 60); while (!(sdone)) { if (second<=59) { second = second++; } else { second == 00; minute = minute ++; } cout << minute << ":" << second << endl; } return (0); } | |
|
|
|
| jsnookiii (8) | |
| But when I try to nest my loops it starts to act a little wonky and only does the second loop and even if I tell it to display everything I will only display the seconds when I test the code. | |
|
|
|