Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This need to be done with c++ has been selected to implement a contest scoring Y

ID: 3768771 • Letter: T

Question

This need to be done with c++
has been selected to implement a contest scoring Your company program for the upcoming Winter Olympics. Each contestant in the Olympics will compete in five (5) competitions. There will be five (5) contestants. Each competition will be scored on a value of 0 through 10 with 10 being the best and 0 being the worst. o develop a program to coll ram to collect Your job as a programmer is t (input) the scores for each of the 5 contestants for each of the5 competitions. (Hint a 2 dimensional array => 5 X 5) Your program will determine the highest score for that completion and display the number of the winner (1 through 5). (Hint: find the largest value in each column). In addition, your program should total up the total scores for the contestants and award 1 place for the overall winner. (Hint: Sum up each row and find the largest value) Your main program will prompt for each contest and allow the entry of the scores for each contestant. For example Contest #1 5 9.3 8.5 7.2 10.0 Contest #2 8.1 7.8 9.2 10.0 7.78.5 Contest #3 Contest #4 Contest #5 The winner for Contest #1 is number 5 The winner for Contest #2 is number 3 The winner. The winner The 1t place winner is number XX Upload your C+ progra when completed. m into the Assignment area and submit

Explanation / Answer

Complete Program:

#include <iostream>
using namespace std;

int main()
{
   const int MAX_COMPETITIONS = 5;
   const int MAX_CONTESTANTS = 5;
  
   double arr[MAX_COMPETITIONS][MAX_CONTESTANTS];
  
   for(int i = 0; i < MAX_COMPETITIONS; i++)
   {
       cout << "Contest #" << (i + 1) << endl;
       for(int j = 0; j < MAX_CONTESTANTS; j++)
       {
           cin >> arr[j][i];
       }
   }
  
  
   for(int i = 0; i < MAX_COMPETITIONS; i++)
   {
       double max = arr[0][i];
       int winner = 0;
      
       for(int j = 0; j < MAX_CONTESTANTS; j++)
       {
           if(arr[j][i] > max)
           {
               max = arr[j][i];
               winner = j;
           }
       }
      
       cout << "The winner for Contest #" << (i + 1) << " is number " << (winner + 1) << endl;
   }
  
   double maxTotal = 0;
   int placeWinner = 0;
  
   for(int i = 0; i < MAX_COMPETITIONS; i++)
   {
       double total = 0;
      
       for(int j = 0; j < MAX_CONTESTANTS; j++)
       {
          
           total += arr[i][j];
       }
      
       if(total > maxTotal)
       {
           maxTotal = total;
           placeWinner = i;
       }
   }
  
   cout << "The 1st place winner is number " << (placeWinner + 1) << endl;
  
   return 0;
}

Sample Output:

Contest #1
7.5 9.3 8.5 7.2 10.0
Contest #2
7.8 9.2 10.0 7.7 8.5
Contest #3
6.9 7 8 9 9.5
Contest #4
8.9 9.1 4.6 8.2 8.0
Contest #5
8.8 9.9 10.0 7.7 6.6
The winner for Contest #1 is number 5
The winner for Contest #2 is number 3
The winner for Contest #3 is number 5
The winner for Contest #4 is number 2
The winner for Contest #5 is number 3
The 1st place winner is number 2

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote