I’m actually going crazy. After spending a lot of time working on Decision making (if-else, switch and …), I really cannot figure out the basic difference between iteration and decision making. In some problems, the tutor asks us to use “While” loop and “break”, instead of “if-else” and it makes me confused. Why???
Yes, yes, I know that it creates a loop, but the problem is that the debugger doesn’t say anything. The program seems to be very well-organized (0 warning, 0 errors). It takes 10 numbers and nothing… freezes! Oh thanks my goodness!
Do something or at least tell me what the heck is wrong with my program.
Let’s start from the first question: There’s a table about the grading structure including ten grades (A,A-,B+,B,B-,C+,C,C-,D+,D,F). One should key-in ten scores (0-100; all integers). We should write a program using a “do-while” loop to print out the grades for every score entered.
So we have ten scores (s1,s2,…,s10) and ten grades (as mentioned above). For every value (score) we key-in, it should decide whether the student should be awarded with (A,A-,…,F). Isn’t it “Decision making”? How to use a loop then?
Let’s solve it first. The second question is even screwier.
Can you gimme a hand mates?
Thanks a bunch
P.S. I’m using a reference book named “Programming in C++: Lessons and Applications” by Timothy B. D’Orazio, McGraw-Hill. This chapter (iteration) is not very well-written (too short to me). Any better suggestion?