Need help with C++ homework

May 31, 2000
75
0
0
I need a .cpp file that will accomplish the following:

The seven judges of a gymnastics competition assign scores between 0.0 and 10.0 to each contestant's routine. The rules state that the high and the low scores are eliminated and the remaining five scores are totalled to find the overall score for the contestant. For example, with the scores of 9.6, 9.5, 9.9, 9.9, 9.7, 9.8, and 9.6, the high score of 9.9 (only one of them) and the low score of 9.5 are eliminated and the remaining scores are totalled to give an overall score of 48.6 for the contestant.

Write a C++ program that prompts the user for the seven scores. Determine the overall score based on the method described above and display the contestant's final score.

To receive full credit for this program, your solution must correctly utilize an array to handle the scores. A solution not utilizing an array in this manner will lose 10 out of 100 points.

 

xcript

Diamond Member
Apr 3, 2003
8,257
1
81
Originally posted by: TrypleCheeseburger
I need a .cpp file that will accomplish the following:

So, write one. Then report back if/when you have a specific problem with it.

You didn't expect anyone to do it all for you did you?
 

screw3d

Diamond Member
Nov 6, 2001
6,906
1
76
Come on do your own homework! :frown: This is a simple problem that can be solved in a few hours by any n00b.
 
May 31, 2000
75
0
0
Here's what I have so far... it wont compile

//c++ final by El Conquistador


#include <iostream.h>
#include "apvector.h"

int main ()
{
apvector (float) scores(7,0); // 7 judges each enter a score
cout << "Judge One Score: \n";
cin >> scores[1]
sytem("PAUSE");
cout << "Judge Two Score: \n";
cin >> scores[2]
sytem("PAUSE");
cout << "Judge Three Score: \n"
cin >> scores[3]
sytem("PAUSE");
cout << "Judge Four Score: \n"
cin >> scores[4]
sytem("PAUSE");
cout << "Judge Five Score: \n"
cin >> scores[5]
sytem("PAUSE");
cout << "Judge Six Score: \n"
cin >> scores[6]
sytem("PAUSE");
cout << "Judge Seven Score: \n"
cin >> scores[7]
sytem("PAUSE");

system ("PAUSE");
return 0;
}
 

CTho9305

Elite Member
Jul 26, 2000
9,214
1
81
Here's a tip... if it won't compile, GIVE US THE ERROR!.

You call two functions I've never heard of - sytem and system. Either someone uses bad naming conventions, or you made the same typo over and over.

Anyway, the braindead thing to do:

dim min, max, sum, i
min = scores[0]
max = scores[0]
for i = 0 to 6
_if scores(I]<min then min=scores(I]
_if scores(I]>max then max=scores(I]
sum=0;
dim didmin, didmax
didmin=0 didmax=0
for i=0 to 6
_if scores(I]=min and didmin=0 then didmin=1
_else if scores(I]=max and didmax=0 then didmax=1
_else sum = sum + scores(I]
print "average: ", sum/5;

If you actually use that algorithm, you deserve a GIANT F, because it's awful. Of course, if this assignment is your FINAL, I guess they didn't teach you very much.
 

Gage8

Senior member
Feb 11, 2003
632
0
0
Originally posted by: TrypleCheeseburger
Originally posted by: screw3d
Come on do your own homework! :frown: This is a simple problem that can be solved in a few hours by any n00b.

Man, just once I want to take the easy way out.

sorry, there is no easy way out in the real world sonny...
 

EagleKeeper

Discussion Club Moderator<br>Elite Member
Staff member
Oct 30, 2000
42,589
5
0
Originally posted by: Gage8
Originally posted by: TrypleCheeseburger
Originally posted by: screw3d
Come on do your own homework! :frown: This is a simple problem that can be solved in a few hours by any n00b.

Man, just once I want to take the easy way out.

sorry, there is no easy way out in the real world sonny...

I beg to differ - stay in school
 

notfred

Lifer
Feb 12, 2001
38,241
4
0
This is about the easiest homework assignment in programming I've ever seen.

I'll do it in perl again, just cause I know you can't translate it to C++:

my @scores;
for my $entry(0..6){
print "Enter score #", $entry+1, ":";
$entry = <>;
chomp $entry;
push @scores, $entry;
}
sort @scores;
unshift @scores;
pop @scores;
my $answer = 0;
for my $score(0..4){
answer += $scores[$score];
}
$answer /= 5;

print "The answer is: $answer \n";
 

singh

Golden Member
Jul 5, 2001
1,449
0
0
Here's a C++ solution. Hopefully, you'll have to modify it a bit to suit your needs
 

WobbleWobble

Diamond Member
Jun 29, 2001
4,867
1
0
Since he's using apvector, I'd say he's in highschool taking Computer Science AP.

Edit: Actually I might take that back. CSAP was transitioning to Java at some point, not sure if it has yet.
 

amheck

Golden Member
Oct 14, 2000
1,712
0
76
I know this has nothing to do with the original subject, but I so see myself in this OP's shoes. I was a CS major. Love computers, HATE programming. College was SO focused on programming it was sick. Needless to say, with some programming help, I graduated and now work in the networking part of the industry. I think it was a little unfair to put so much weight on the programming aspect, cause there's really so much more out there.

Aaron
 

Barnaby W. Füi

Elite Member
Aug 14, 2001
12,343
0
0
CS == algorithms and programming. Eh, I think you should have known/figured that out beforehand, kind of pointless to argue with it IMO.
 
sale-70-410-exam    | Exam-200-125-pdf    | we-sale-70-410-exam    | hot-sale-70-410-exam    | Latest-exam-700-603-Dumps    | Dumps-98-363-exams-date    | Certs-200-125-date    | Dumps-300-075-exams-date    | hot-sale-book-C8010-726-book    | Hot-Sale-200-310-Exam    | Exam-Description-200-310-dumps?    | hot-sale-book-200-125-book    | Latest-Updated-300-209-Exam    | Dumps-210-260-exams-date    | Download-200-125-Exam-PDF    | Exam-Description-300-101-dumps    | Certs-300-101-date    | Hot-Sale-300-075-Exam    | Latest-exam-200-125-Dumps    | Exam-Description-200-125-dumps    | Latest-Updated-300-075-Exam    | hot-sale-book-210-260-book    | Dumps-200-901-exams-date    | Certs-200-901-date    | Latest-exam-1Z0-062-Dumps    | Hot-Sale-1Z0-062-Exam    | Certs-CSSLP-date    | 100%-Pass-70-383-Exams    | Latest-JN0-360-real-exam-questions    | 100%-Pass-4A0-100-Real-Exam-Questions    | Dumps-300-135-exams-date    | Passed-200-105-Tech-Exams    | Latest-Updated-200-310-Exam    | Download-300-070-Exam-PDF    | Hot-Sale-JN0-360-Exam    | 100%-Pass-JN0-360-Exams    | 100%-Pass-JN0-360-Real-Exam-Questions    | Dumps-JN0-360-exams-date    | Exam-Description-1Z0-876-dumps    | Latest-exam-1Z0-876-Dumps    | Dumps-HPE0-Y53-exams-date    | 2017-Latest-HPE0-Y53-Exam    | 100%-Pass-HPE0-Y53-Real-Exam-Questions    | Pass-4A0-100-Exam    | Latest-4A0-100-Questions    | Dumps-98-365-exams-date    | 2017-Latest-98-365-Exam    | 100%-Pass-VCS-254-Exams    | 2017-Latest-VCS-273-Exam    | Dumps-200-355-exams-date    | 2017-Latest-300-320-Exam    | Pass-300-101-Exam    | 100%-Pass-300-115-Exams    |
http://www.portvapes.co.uk/    | http://www.portvapes.co.uk/    |