C Board  

Go Back   C Board > General Programming Boards > C++ Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 02-24-2009, 04:33 PM   #1
Registered User
 
Join Date: Feb 2009
Posts: 1
Noob needing some help and insight

well i am taking c++ in college having a bit of difficulty on grasping it a bit basically im just wondering if someone could take a look to see what im doing wrong in this i would appreciate the help and criticism. like i said it is a class project so this is the project in detail:

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   Reply With Quote
Old 02-24-2009, 04:41 PM   #2
Cat without Hat
 
CornedBee's Avatar
 
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   Reply With Quote
Reply

Tags
c++, class, homework, project, school

Thread Tools
Display Modes

Forum Jump


All times are GMT -6. The time now is 03:23 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22