int songNumber;
int totalMinutes;
int totalSeconds;
int current;
int newMinutes;
int newSeconds;
int newtotalMinutes = 0;
int newtotalSeconds = 0;
int timeUsed =0;
int minLeft =0;
int secLeft =0;
int totalTime;
Do you want to have this: endl here << newtotalSeconds << endl; ?
That will draw a newline and flush the output buffer, so I guess that's not what you want.
Song Song Time Total Time
Number Minutes Seconds Minutes Seconds
------ ------- ------- ------- -------
1 0 1 0 1
2 5 50 5 51
3 0 2 5 53
4 7 42 13 35
5 0 3 13 38
6 4 19 17 57
7 0 4 18 1
8 4 33 22 34
9 0 5 22 39
10 10 27 33 6
11 0 6 33 12
12 8 55 42 7
13 0 7 42 14
14 5 0 47 14
There are 32 minutes and 46 seconds left on the CD.
It should look like this:
Song Song Time Total Time
Number Minutes Seconds Minutes Seconds
------ ------- ------- ------- -------
1 5 10 5 10
2 7 42 12 52
3 4 19 17 11
4 4 33 21 44
5 10 27 32 11
6 8 55 41 6
7 5 0 46 6
There are 33 minutes and 54 seconds of space left on the 80-minute CD.
My guess is you're looking for data that is smaller than your data type, like if you were looking for only a single byte but were using a 2 byte data type but poking in both bytes of that data. Similar errors can be made when using unions.