I have written a program to input test/program grades from multiple students to calculate various average's. They are weighted: tests are 80% and programs are 20%. The program works perfectly except that the final 3 average's are not calculating correctly. Here is some test data:
Number of Tests: 5
Number of Programs: 3
Name Test Grades Program Grades
Myles 80,75,65,90,88 94,85,89
Garrett 90,72,87,96,79 71,72,82
Exactly what do you mean by separating them out. I forgot to mention that I am in a Foundations of Programming class. So I am a beginner. What exactly does global mean, as far as variables are concerned? I look forward to learning from your input. Thank you.
Wow. Thank you. I did not expect you to re-write it, but thank you. I will definitely read on the global variables though. I just glanced at the page and from what I read I can tell you that the reason most of my variables are global is because this class is to introduce thinking in a "programmer's" perspective. To get to thinking about algorithm's and logic. But once again, thank you.
What's with all the endls? You surely don't need to flush the output buffer four times? Replace those endls with "\n"s instead and your code will be faster.
That's just the easiest and fastest way my mind looks at code. I have noticed in my past 3 labs that "\n" is very easy to use, so I do plan on using it in the future. Thank you though for letting me know it runs faster. I did not know this. But, of course, I'm in a beginning programming course and we are not yet dealing with large programs. Thank you once again.
I should add, that you most probably won't notice a difference with that amount of them. But in a large program that inexplicably uses standard streams, it's a little faster.