#include "stdafx.h" #include <iostream> #include <string> using namespace std; double calculateGrade (double score) { if (score<=100 && score>=90) { cout << "You got an A" << endl; } else { if (score>=80 && score<=89) { cout << "You got an B" << endl; } else { if (score>=70 && score<=79) { cout << "You got an C" << endl; } else { if (score>=60 && score<=69) { cout << "You got an D" << endl; } else { if (score<60) { cout << "You got an F" << endl; } } } } } return score; } int _tmain(int argc, _TCHAR* argv[]) { int total; int score; int i; int average=0; i =1; cout << "Your score must be between 0 and 100" << endl; total =0; while (!(i>5)) { cout << "what is your score?" << endl; cin >> score; i =i+1; calculateGrade(score); total =total+score; } } double calculateAverage ( double total) { double average; average =total/5; cout << "your average is "<<average << endl; return 0; }
This post has been edited by alexandru80: 09 April 2009 - 09:07 AM