Using C++ Write a program to keep records and perform statistical analysis for a
ID: 663574 • Letter: U
Question
Using C++
Write a program to keep records and perform statistical analysis for a class os students. The class may have up to 40 students. There are five quizzes during the term. Each student is identified by a four-digit student number,
The program will print the students scores and calculate and print the statistics for each quiz. The output is in the same oerder as the input; no sorting is needed. The input will be read from a text file
What am I doing wrong??
16 1 C:Chapter8Program.cpp [Error] expected unqualified-id before '{' token
//This program will go hrough each element of the student array and calculat the lowest, highiest, and average value of quizzes//
#include
// function
void report(int arr[][6]);
int main(int argc, char**argv);
{ THIS IS WHERE I AM GETTING THE ERROR MESSAGE
int student[][6]={{1234,52,7,100,78,34},{2134,90,36,90,77,30},{3124,100,45,20.90,70},
{4532,11,17,81,32,77},{5678,20,12,45,78,34},{8134,34,80,55,78,45},{7874,60,100,68,78,78},
{8026,70,10,66,78,56},{9893,34,9,77,78,20},{1947,45,49,88,78,55},{2877,55,50,99,78,80},
{3189,22,70,100,78,77},{4062,89,50,91,78,60},{5405,11,11,0,78,10},{6999,0,98,89,78,20}};
report(student);
system("pause");
return 0;
}
void report(int arr[15][6]);
{
int value[10];
int ind;
int r,c;
printf("StudentQuiz1Quiz2Quiz3Quiz4Quiz5");
//Print Score of all the students in tabular form using for loop//
for(r=0;r<;r++);
}
for(c=0;c<6;c++);
printf("%d ",arr[r][c]);
printf("");
}
//Print the highiest lowest and average score //
for(ind=0;ind<3;ind++);
{
int v;
if(ind==0);
{printf("Highiest score for the student");
printf("High ");
}
if(ind===1);
{
printf("lowest score for the student");
printf("Low ");
}
if(ind==2);
{
printf("Average score for the student");
printf("Average ");
}
for(c=1;c<6;c++);
{
float sum=0;
v=arr[1][c];
for(r=0;r<15;r++);
{
if(ind==0);
{
if(arr[r][c]>v);
v=arr[r][c];
}
if(ind==1);
if(arr[r][c]<v);
v=arr[r][c];
if(ind==2);
{
//Score//
sum+=arr[r][c];
}
}
if(indt=2);
// Print highiest and Lowest scores in each column//
printf("%d ",sum/15);
}
print("");
}
}
Explanation / Answer
The basic error in the above code are the following:
1) When starting a function definition, the function name must not end in a semi-colon. For example, consider the following code snippet:
Check this error globally in the code.
2) Consider the following code snippet:
if(ind===1);
{
printf("lowest score for the student");
printf("Low ");
}
Use == instead of ===.
3) In the following code snippet:
for(r=0;r<;r++);
}
for(c=0;c<6;c++);
printf("%d ",arr[r][c]);
printf("");
}
use starting brace instead of closing brace in the above snippet. In addition, the condition is incomplete in
for(r=0;r<;r++);
4) Remove all semicolons from after the for loop. Do it globally in the code.
5) Check the placement of opening and closing braces throughout the program. There are a lot of errors in the same.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.