Answer to Question #256697 in C++ for Dion Martins

Question #256697

Do the necessary planning (IPO) and write an algorithm in pseudo code for the following:


1 An unknown number of toddlers are taking part in a competition. 5 adjudicators will give each competitor a mark out of 10. These marks are added together to get a mark out of 100. Write a complete C++ program to do the following

 Enter the competitor’s number. ( -1 is entered to terminate the input).

 Enter 10 marks out of 10 for each competitor.

 Calculate the total mark.

 Compare it to the marks of previous competitors to obtain the highest mark.

 Enter the number of the following competitor.

 When all data have been processed, display the number of the competitor with the highest mark as well as the current competitor’s mark.


1
Expert's answer
2021-11-01T06:35:53-0400
#include <iostream>


using namespace std;


int main()
{
    int n;
    cout<<"\nEnter number of competitors: ";
    cin>>n;
    int marks[n];
    
    cout<<"\nEnter marks of n competitors, -1 to exit:\n";
    int i=0;
    while(true){
        cin>>marks[i];
        if(marks[i]==-1)
            break;
        i++;
    }
    int max=marks[0];
    int min=marks[0];
    for(int i=0;i<n;i++){
        if(marks[i]>max)
            max=marks[i];
        if (marks[i]<min)
            min=marks[i];
    }
    cout<<"\nMaximum marks: "<<max;
    cout<<"\nMinimum marks: "<<min;


    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