Answer to Question #275305 in C++ for Zodiak

Question #275305

Third year programming students have entered a hackathon competition and they are judged by two judges who gives them a score from 1 to 100. You are required to write a program that will help the organizers to tally their scores as well as to determine who the winner is.


1
Expert's answer
2021-12-04T01:27:36-0500
#include<iostream>
#include<conio.h>


using namespace std;




int main()
{
	int n;
	int score1;
	int score2;
	int winnerStudent=0;
	int winnerStudentScore=-1;
	cout<<"Enter the number of students: ";
	cin>>n;
	for(int i=0;i<n;i++){
		cout<<"\nEnter scores for student "<<(i+1)<<"\n\n";
		do{
			cout<<"Enter score of judge 1: ";
			cin>>score1;
		}while(score1<1 || score1>100);
		do{
			cout<<"Enter score of judge 2: ";
			cin>>score2;
		}while(score2<1 || score2>100);
		int totalScore=score1+score2;
		if(totalScore>winnerStudentScore){
			winnerStudentScore=totalScore;
			winnerStudent=i;
		}
	}
	cout<<"\nThe student "<<(winnerStudent+1)<<" is the winner\n\n";
	cin>>winnerStudentScore;
	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