I am supposed to use arrays to create a program that removes the lowest number and highest number. Than it needs to add the rest but I can't even get my program to run.
The user needs to enter 8 scores:9.2,9.3,9.0,9.9,9.5,9.5,9.6,9.8.
the output should be:
contestant recieves: 56.90
Dropped low score: 9.00
Dropped High Score: 9.90
Any help to fix these errors will be appreciated. I'm not good at C++.
Code:10 F:\Program6-Arrays2.0.cpp expected init-declarator before "int" 10 F:\Program6-Arrays2.0.cpp expected `,' or `;' before "int" F:\Program6-Arrays2.0.cpp In function `void getinput(int*, int)': 33 F:\Program6-Arrays2.0.cpp `num' undeclared (first use this function) (Each undeclared identifier is reported only once for each function it appears in.) 35 F:\Program6-Arrays2.0.cpp `counter' undeclared (first use this function) 38 F:\Program6-Arrays2.0.cpp `score' undeclared (first use this function) 39 F:\Program6-Arrays2.0.cpp `sum' undeclared (first use this function) F:\Program6-Arrays2.0.cpp In function `int getlow(int*, int)': 49 F:\Program6-Arrays2.0.cpp `numbers' undeclared (first use this function) 50 F:\Program6-Arrays2.0.cpp `SIZE' undeclared (first use this function) 59 F:\Program6-Arrays2.0.cpp a function-definition is not allowed here before '{' token 59 F:\Program6-Arrays2.0.cpp expected `,' or `;' before '{' token 86 F:\Program6-Arrays2.0.cpp expected `}' at end of input
CODE:
Code:#include<iostream> #include<cmath> #include<conio.h> #include<iomanip> //needed for setw() using namespace std; // Function prototypes int getlow(int[],int) int gethigh(int[],int) double getsum(int[],int) void getinput(int[],int) void showoutput(int[],int) int main() { int getlow,gethigh,numbers[SIZE]; double getsum,scores; const int SIZE = 50; void getinput(int[],int) int getlow(int[],int) int gethigh(int[],int) double getsum(int[],int) void showoutput(int[],int) } void getinput(int[],int) { cout << "Enter number of Judges Scores:"; cin >> num; while (counter <= num ) { cout << "Enter Judges Score #" <<counter << ":"; cin >> score; sum+=score; counter++; } } int getlow(int[],int limit) { int count; int lowest; lowest = numbers[0]; for (count = 1; count < SIZE; count++) { if (numbers[count]<lowest) lowest = numbers[count]; } int gethigh(int[],int) { int count; int highest; highest=numbers[0]; for(count=1;count<SIZE;count++) { if(numbers[count]> highest) highest=numbers[count]; } double getsum(int[],int) { double scores; scores+=score scores-=lowest scores-=highest } void output[int[],int] { cout<<setprecision(1)<<fixed<<showpoint; cout<<"Contestant Receives: "<<scores<<endl; cout<<"Dropped Low Score: "<<lowest<<endl; cout<<"Dropped High Score: "<<highest<<endl; system("pause"); }



1Likes
LinkBack URL
About LinkBacks



