|
-
July 27th, 2010, 03:23 PM
#23
Re: Simple GradeSystem
 Originally Posted by Zeveso
i made comments, but ok... let me try again...
Code:
for ( gradeNumber; canWe == true; gradeNumber++; ){
cout << "Please submit the next grade." << endl << "Grade: ";
cin >> submitAmount;
submitAmount + totalAmount = totalAmount;
cout << "Thank you, the grade has been added." << endl;
cout << "Would you like to add another grade or would you like to quite?" << endl;
cout << "Type 1 to contine or type 2 to quite and press <enter>." << endl << "1 or 0: "; // may need to be switched to true or false
cin >> canWe >> endl;
return totalAmount, gradeNumber;
}
gradeNumber is the amount of averages, so lets say i have 100 90 and 80 that is 3 'gradeNumber's
canWe wants to know if we can continue, it it is true that we want to continue... then do the whole loop over again
gradeNumber++ lets us raise the amount of averages every time we run the loop
ex. loop run once gradeNumber = 1 loop run twice gradeNumber = 2 ect...
hope you understand now
But that's not how you do it. What you want is something like
Code:
for(int nCurrentGrade = 0; nCurrentGrade < gradeNumber; nCurrentGrade++)
That's if you're getting a specific number of grades. If you're going till the user says stop you want a while loop
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|