Your company has been selected to implement a contest scorin


Your company has been selected to implement a contest scoring 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.
Your job as a programmer is to develop a program to collect (input) the scores for each of the 5 contestants for each of the 5 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 1st 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
       7.5 9.3 8.5 7.2 10.0
   Contest #2
       8.1 7.8 9.2 10.0 7.7 8.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 winner ……
The 1st place winner is number XX

Solution

code:

#include <iostream> // std:s:cin, std::cout
#include <fstream> // std::ifstream
#include <map>
using namespace std;
int main () {
int p1=0;
int p2=0;
int p3=0;
int p4=0;
int p5=0;
int arr[5][5];
int i=0;
int j=0;
int max[5];
int p[5];
for(i=0;i<5;i++)
{
    cout<<\"enter scores of contest \"<<i+1<<endl;
    int maxi =-1000;
    int no=0;
    for(j=0;j<5;j++)
    {
        p[j]+=arr[i][j];
        cin>>arr[i][j];
        if(arr[i][j]>maxi)
        {
        maxi=arr[i][j];
       no =j+1;  
       }
       
   }
   max[i]=no;
}

for(i=0;i<5;i++)
{
    cout<<\"The winner for contest#\"<<i+1<<\" is number \"<<max[i]<<endl;
}
cout<<\"The first place winner is: \";
int maxi= -10000;
int no=0;
for(i=0;i<5;i++)
{
    if(p[i]>maxi)
    {
   maxi=p[i];
   no =i+1;     
   }

}
cout<<no;


   return 0;
}

 Your company has been selected to implement a contest scoring program for the upcoming Winter Olympics. Each contestant in the Olympics will compete in five (5
 Your company has been selected to implement a contest scoring program for the upcoming Winter Olympics. Each contestant in the Olympics will compete in five (5

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site