In the Winter Olympics, figure skating is always a popular category of events. A
ID: 3567654 • Letter: I
Question
In the Winter Olympics, figure skating is always a popular category of events. A few years back, there was a big scandal involving scoring in figure skating, and a new system called the ISU Judging System was developed and is now used in big international competitions. The old system called the 6.0 system is still in use in some US competitions which may have difficulty assembling the technical panel of 5 specialists required by the ISU system.
The 6.0 system is complex so you are asked to write a program that will do the calculations and determine the final ranking of the skaters. The program should be able to handle up to 11 judges (11 is unlikely, but possible; usually, it
Explanation / Answer
#ifndef Judges
#define Judges
#include "Skaters.h"
class Judges
{
public:
int sc1, sc2;
int ranking, totals;
Skaters skat[50];
Judges(){}
void setScores();
int getScores();
void setRanking();
int getRanking();
}
#endif
#include "stdafx.h"
#include "Judges.h"
#include <iostream>
using namespace std;
void Judges:: setScores()
{
for(int i=0;i<5;i++)
{
cout<<"Enter the score1: ";
cin>>sc1;
skat[i].setScore1(sc1);
cout<<"Enter the score2: ";
cin>>sc2;
skat[i].setScore1(sc2);
totals=skat[i].getTotal();
}
}
int Judges :: getScores()
{
return totals;
}
void Judges :: setRanking()
{
Skaters temp;
int b[50];
for(int i=0;i<5;i++)
{
b[i]=skat[i];
}
for(int i=0;i<5;i++)
{
for(int j=i+1; j<=10; j++)
{
if(b[i].getTotal()>b[j].getTotal())
{
temp=b[i];
b[i]=b[j];
b[j]=temp;
}
}
}
for(int i=0;i<5;i++)
{
for(int j=0;j<5;j++)
{
if(b[i].getTotal==skat[j].getTotal())
{
skat[j].setRank(i+1);
}
}
}
}
static void display()
{
for(int i=0;i<5;i++)
{
cout<<skat[i].getId()<<" "<<skat[i].getTotal()<<" "<<skat[i].getRank()<<endl;
}
}
#ifndef Skaters
#define Skaters
class Skaters
{
public:
int id;
Skaters()
{
score1=0;
score2=0;
total=0;
}
void setScore1(int s1);
void setScore2(int s2);
void setId(int id);
int getId();
int getTotal();
void setRank(int r);
int getRank();
int score1, score2, total;
int rank;
}
#endif
#include "stdafx.h"
#include "Skaters.h"
void Skaters::setScore1(int s1)
{
score1=s1;
}
void Skaters::setScore2(int s2)
{
score2=s2;
}
int Skaters::getTotal()
{
return score1+score2;
}
void Skaters::setRank(int r)
{
rank=r;
}
int Skaters::getRank()
{
return rank;
}
void Skaters::setId(int i)
{
id=i;
}
int Skaters::getId()
{
return id;
}
// SkatersOlympics.cpp : main project file.
#include "stdafx.h"
#include "Judges.h"
#include "Skaters.h"
#include <iostream>
using namespace std;
int main()
{
Judges judge[11];
Skaters skates[50];
int c1, c2, c3, c4,c5,c6;
int x[10];
int x=0, y, z;
int numJudge;
cout<<"Enter number of judges: ";
cin>>numJudge;
for(int i=0;i<5;i++)
{
x[i]=skates[i].getTotalScore(i);
}
Skaters temp
for(int i=0;i<5;i++)
{
for(int j=i+1; j<=10; j++)
{
if(skates[i].getTotal()>skates[j].getTotal())
{
temp=skates[i];
skates[i]=skates[j];
skates[j]=temp;
}
}
}
cout<<"The order list of skaters is : "
Judges.display();
system("pause");
return 0;
}
int getTotalScore(int k)
{
int y=0;
for(int j=0;j<numJudge;j++)
{
y+=judge[j].skates[k].getRank();
}
}
return y;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.