Answer to Question #217938 in C++ for Abdulhamid

Question #217938
Write a program that prompts the user to enter the number of students, each
student’s score, and finally display the highest score
1
Expert's answer
2021-07-17T01:29:39-0400
/******************************************************************************
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;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS