Hello, I am currently enrolled in a college course at the community college I attend to, which I'm a Middle College Student currently enrolled in the 10th grade, and I'm currently Having a hard time with my C++ assignment. My output isn't the same as my college instructor and in all honestly I'm kinda lost however i manage to look at his example but I am still having a hard actually writing the code.
OF MY CODE but my College instructor has something different.
Song Song Time Total Time
Number Minutes Seconds Minutes Seconds
------- ------- ------- ------- -------
1 8 2 8 2
2 10 1 10 1
3 4 19 4 19
4 16 23 16 23
5 4 33 4 33
6 9 27 9 27
7 9 27 9 27
There are -4 minutes and -17 seconds left of space on the 80 minute CD.
FROM PROFESSOR
Song Song Time Total Time
Number Minutes Seconds Minutes Seconds
1 5 10 5 10
2 7 42 12 52
5 4 19 17 11
3 4 33 21 44
4 9 27 31 11
6 8 55 40 6
7 5 0 45 6
There are 34 minutes and 54 seconds of space left on the 80 minute CD.
Also, for code, put [code] before your code and [/code] after it, an for output (like you just posted) put [output] before the output and [/output] after your output. You can (and should) edit your existing posts.
First of all you are getting the wrong minutes and seconds and secondly total you should be adding the previous values each time and not display the same thing each time and when seconds > 60 you must subtract 60 from seconds and add 1 to minutes.
Just put something like this for line 88 and 89
5 min 10 second
8 minute 2 second
10 minute 1 second
4 minute 19 second
16 minute 23 second
4 minute 33 second
9 minute 27 second
-12 second
8 minute 55 second
45 second
5 minute
These look close to what your teacher has but not the same
Still The same. If only I the required textbook maybe that could help, but since I'm a middle college student I'm not allow to bring the text book home
Song Song Time Total Time
Number Minutes Seconds Minutes Seconds
------- ------- ------- ------- -------
1 8 2 8 2
2 10 1 18 3
3 4 19 22 22
4 16 23 38 45
5 4 33 43 18
6 9 27 52 45
7 9 27 62 12
There are -57 minutes and -2 seconds left of space on the 80 minute CD.
You read in the first number before your while loop, so the first song's length is now in totalTime, which you don't use afterwars except on line 108: totalTime = (80 * 60); where you just assign it a new value. Also, you while-loop will only allow for 7 songs to be read in, yet you have 12 lines in your input file.
A better way to read in all the data would probably be:
1 2 3 4 5 6 7 8 9
int tmp;
while (inData >> tmp)
{
if (tmp > 0) //check for negative input
{
minutes = tmp / 60;
seconds = tmp % 60;
}
}
You will need to adapt this to your program of course.
Please do let us know if you require any further assistance.
I would like more help please. I had ask my classmates but none of them wanted to help. One even said i didn't belong in the course. The instructor left to a meeting so i wasn't able to ask questions.
Thanks for all the help. I believe I got it. My output is not identical to my college professor but as for a 10th grader in a college course I think i got it. :)