/******************************************************************************
Write a program that prompts the user to enter the number of students, each
student’s score, and finally display the highest score
*******************************************************************************/
#include <iostream>
using namespace std;
int main()
{
int n;
cout<<"\nEnter the number of students: ";
cin>>n;
int scores[n];
for(int i=0;i<n;i++){
cout<<"\nEnter student "<<i<<" score: ";
cin>>scores[i];
}
int highest=scores[0];
for(int i=0;i<n;i++){
if(scores[i]>highest){
highest=scores[i];
}
}
cout<<"\nThe highest score is "<<highest<<endl;
return 0;
}
Comments
Leave a comment