1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
|
#include <iostream>
#include <cstdlib>
using namespace std;
void getJudgeData(double &, double &, double &, double &,double &);
void getCalcScore(double &, double &, double &, double &,double &);
int findLowest();
int findHighest();
double lowNum();
double highNum();
int main()
{
double score1, score2, score3, score4, score5;
double getJudgeData1,getJudgeData2,getJudgeData3,getJudgeData4,getJudgeData5;
cout<<"\nHello! this program will calculate the contestants score.\n";
cout<<"Now, please enter your score: ";
getJudgeData1(score1);
getJudgeData2(score2);
getJudgeData3(score3);
getJudgeData4(score4);
getJudgeData5(score5);
cout<<score1<<score2<<score3<<score4<<score5;
cout<<endl;
}
double getJudgeData1(double &Escore1)
{
cout<<"Judge 1, please enter your score!: ";
cin>>Escore1;
while (Escore1<0 || Escore1 >10)
{
cout<<"Sorry buddy, no scores lower than or equal to 0\n";
cout<<"Or scores higher or equal to 10.\n";
cout<<"Please re-enter a score between 0 and 10\n : ";
cin>>Escore1;
}
return Escore1;
}
double getJudgeData2(double &Escore2)
{
cout<<"Judge 2, please enter your score!: ";
cin>>Escore2;
while (Escore2<0 || Escore2 >10)
{
cout<<"Sorry buddy, no scores lower than or equal to 0\n";
cout<<"Or scores higher or equal to 10.\n";
cout<<"Please re-enter a score between 0 and 10\n : ";
cin>>Escore2;
}
return Escore2;
}
double getJudgeData3(double &Escore3)
{
cout<<"Judge 3, please enter your score!: ";
cin>>Escore3;
while (Escore3<0 || Escore3 >10)
{
cout<<"Sorry buddy, no scores lower than or equal to 0\n";
cout<<"Or scores higher or equal to 10.\n";
cout<<"Please re-enter a score between 0 and 10\n : ";
cin>>score3;
}
return Escore3;
}
double getJudgeData4(double &Escore4)
{
cout<<"Judge 4, please enter your score!: ";
cin>>Escore4;
while (Escore4<0 || Escore4 >10)
{
cout<<"Sorry buddy, no scores lower than or equal to 0\n";
cout<<"Or scores higher or equal to 10.\n";
cout<<"Please re-enter a score between 0 and 10\n : ";
cin>>score4;
}
return Escore4;
}
double getJudgeData5(double &Escore5)
{
cout<<"Judge 5, please enter your score!: ";
cin>>Escore5;
while (Escore5<0 || Escore5 >10)
{
cout<<"Sorry buddy, no scores lower than or equal to 0\n";
cout<<"Or scores higher or equal to 10.\n";
cout<<"Please re-enter a score between 0 and 10\n : ";
cin>>Escore5;
}
return Escore5;
}
|