![]() |
| | #1 |
| Registered User Join Date: Feb 2009
Posts: 1
| Noob needing some help and insight Lowest Score Drop Write a program that calculates the average of a group of test scores, where the lowest score in the group is dropped. It should use the following functions: • void getScore() should ask the user for a test score, store it in a reference parameter variable, and validate it. This function should be called by main once for each of the five scores to be entered. • void calcAverage() should calculate and display the average of the four high- est scores. This function should be called just once by main, and should be passed the five scores. • int findLowest() should find and return the lowest of the five scores passed to it. It should be called by calcAverage, which uses the function to determine which of the five scores to drop. Input Validation: Do not accept test scores lower than 0 or higher than 100. (Starting Out with C++: From Control Structures through Objects, 6th Edition. 03/19/2008: Addison-Wesley, 03/19/2008. 377). #include <iostream> using namespace std; // function prototype void getScore(int); void calcAverage(); int main() { char restartProgram; // restarting program for next set of grades cout << "This Program will average\n"; cout << " the test scores you input, \n"; cout << "and will drop the smallest grade." << endl; getScore(int sum); return 0; } void getScore(int sum) { double testScore; int sum = 0; int count; do { for(count = 1; count <= 5; count++) { cout << "Enter test score number " << count << endl; cin >> testScore; if(testScore < 0 || testScore > 100) // make sure real test number { cout << testScore << " is an invalid entry. Please input correct score.\n"; break; } else { sum += testScore; } __________________________________________________ _____________ thanks in advance for even givin this a peek |
| punktilend is offline | |
| | #2 |
| Cat without Hat Join Date: Apr 2003
Posts: 8,439
| Please post code properly formatted and within code tags, to preserve that formatting.
__________________ All the buzzt! CornedBee"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code." - Flon's Law |
| CornedBee is offline | |
![]() |
| Tags |
| c++, class, homework, project, school |
| Thread Tools | |
| Display Modes | |
|