Write a program that can compute the average exam grade for multiple students.
• Each student has the same POLICY of exam grades -DEFINE Your own policy
• Prompt the user for the number of exams
• When you finish a student prompt the user to see if there are more students to process
#include<iostream>
using namespace std;
int main(){
int x;
do{
cout<<"Enter the number of exams:\n";
int n ;
cin>>n;
int marks[n];
int sum = 0;
cout<<"Enter the marks for the student:\n";
for(int i=0; i<n; i++){
cin>>marks[i];
sum += marks[i];
}
cout<<"The average is: "<<sum /n<<endl;
cout<<"Are there more students to process:\n Enter 1 to continue else 2 to stop:\n";
cin>>x;
} while(x==1);
}
Comments
Leave a comment