/***************************************************/ // L Frye // CSC135010 - Spring 2008 // Program #1 // Due: Feb 14, 2008 // Filename: avgs.cpp // Description: This program will find a student's test average /***************************************************/ #include #include #define NUMTESTS 3 using namespace std; int main() { // variable declarations string name; // student's name float test1, test2, test3; float avg; // test average // get input cout << "Enter student's name: "; getline(cin, name); cout << "Enter first test score: "; cin >> test1; cout << "Enter second test score: "; cin >> test2; cout << "Enter third test score: "; cin >> test3; // processing avg = (test1 + test2 + test3) / NUMTESTS; // print results cout << fixed << showpoint; // print in fixed-point with decimal cout << setprecision(2); // print two places after decimal cout << endl << endl; cout << left << setw(25) << name; cout << "Average = "; cout << right << setw(7) << avg << "%" << endl; cout << endl; return 0; }