Any amount of information is useful. Program Details The application you will ha
ID: 3551124 • Letter: A
Question
Any amount of information is useful.
Program Details
The application you will have to design is a database manager using arrays. Create a database for as many students as the user wants for 6 different quizzes. The user will then be prompted to store the students scores and after that whether the user wants the average of a specific quiz, the letter grade of a certain student, or the average of the whole class.
Program menu should look like this:
Please choose an option:
1) To store the scores for students
Explanation / Answer
MODIFIED according ti you ... See if i can help more
#include<iostream>
using namespace std;
struct record
{
int score[6];
}s[350];
int n=0;
int menu();
bool check();
int main()
{
int ch;
while(1)
{
ch=menu();
if(ch==0)
break;
else if(ch>4)
cout<<"Invalid option....";
else if(ch==1)
{
cout<<"Enter number of students : ";
cin>>n;
for(int i=0;i<n;i++)
{
cout<<"--------------Enter details of student "<<i+1<<endl;
for(int j=0;j<6;j++)
{
cout<<"Enter marks in quiz "<<j+1<<" :";
cin>>s[i].score[j];
cout<<endl;
}
}
}
else if(ch==2)
{
if(n==0)
check();
else
{
cout<<"Enter Quiz number : ";
int q;
cin>>q;
double a=0;
for(int i=0;i<n;i++)
a+=s[i].score[q-1];
a/=n;
cout<<"Average for quiz "<<q<<" is "<<a<<endl;
}
}
else if (ch==3)
{
if(n==0)check();
if(n==0 )break;
cout<<"Enter student number : ";
int st;
cin>>st;
//cout<<endl<<"Average of student "<<st<<" is :";
int z=0;
for(int i=0;i<6;i++)
z+=s[st-1].score[i];
double y=z/6;
//cout<<y<<endl;
if(y>93)
cout<<"A ";
else if(87)
cout<<"A- ";
else if(83)
cout<<"B+ ";
else if(80)
cout<<"B ";
else if(77)
cout<<"B- ";
else if(73)
cout<<"C+ ";
else if(70)
cout<<"C ";
else if(67)
cout<<"C- ";
else
cout<<"Fail ";
}
else if(ch==4)
{
if(n==0) break;
for(int i=0;i<6;i++)
{
cout<<"Average for quiz "<<i+1<<" is : ";
int sum=0;
for(int j=0;j<n;j++)
{
sum+=s[j].score[i];
}
double an=sum/n;
cout<<an<<endl;
}
}
}
return 0;
}
int menu()
{
int ch;
cout<<"Menu ";
cout<<"1) To store the scores for students
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.