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
|
#include <cstdlib>
#include <iostream>
using namespace std;
int main()
{
string name;
double hyt1, hyt2, hyt3, d1, d2, d3, m1, m2, m3, y1, y2, y3;//hyt=height, d1-3=day, m1-3=month, y1-3 = year
cout << " Enter the name of the pole vaulter: ";
cin >> name;
cout << " Enter one the vaulter's best height in feet: ";
cin >> hyt1;
cout << " Enter the day, month, and year it was achieved. (Seperate with sapces) ";
cin >> d1 >> m1 >> y1;
cout << " Enter a second height for the vaulter: ";
cin >> hyt2;
cout << " Enter the day, month, and year it was achieved. (Seperate with sapces) ";
cin >> d2 >> m2 >> y2;
cout << " Enter a third height for the vaulter: ";
cin >> hyt3;
cout << " Enter the day, month, and year it was achieved. (Seperate with sapces) ";
cin >> d3 >> m3 >> y3;
{
if (hyt1 < 2 && hyt1 > 5 || hyt2 < 2 && hyt2 > 5 || hyt3 < 2 && hyt3 > 5)
{
{ //check if height 1 was highest
if(hyt1 > hyt2 && hyt1 > hyt3)
{
if(hyt2 > hyt3) //if he did, then check to see where 2 and 3 placed
{
cout << " " << name << "'s best times are as follows: \n";
cout << hyt1 <<('\t') << ('\t') << d1<<"/"<<m1<<"/"<<y1<<endl;
cout << hyt2 <<('\t') << ('\t') << d2<<"/"<<m2<<"/"<<y2<<endl;
cout << hyt3 <<('\t') << ('\t') << d3<<"/"<<m3<<"/"<<y1<<endl;
}
else
{
cout << " " << name << "'s best times are as follows: \n";
cout << hyt1 <<('\t') << ('\t') << d1<<"/"<<m1<<"/"<<y1<<endl;
cout << hyt3 <<('\t') << ('\t') << d3<<"/"<<m3<<"/"<<y1<<endl;
cout << hyt2 <<('\t') << ('\t') << d2<<"/"<<m2<<"/"<<y2<<endl;
}
}
}
{ //check if height 2 was highest
if(hyt2 > hyt1 && hyt2 > hyt3)
{
if(hyt1 > hyt3) //if he did, then check to see where 1 and 3 placed
{
cout << " " << name << "'s best times are as follows: \n";
cout << hyt2 <<('\t') << ('\t') << d2<<"/"<<m2<<"/"<<y2<<endl;
cout << hyt1 <<('\t') << ('\t') << d1<<"/"<<m1<<"/"<<y1<<endl;
cout << hyt3 <<('\t') << ('\t') << d3<<"/"<<m3<<"/"<<y1<<endl;
}
else
{
cout << " " << name << "'s best times are as follows: \n";
cout << hyt2 <<('\t') << ('\t') << d2<<"/"<<m2<<"/"<<y2<<endl;
cout << hyt3 <<('\t') << ('\t') << d3<<"/"<<m3<<"/"<<y1<<endl;
cout << hyt1 <<('\t') << ('\t') << d1<<"/"<<m1<<"/"<<y1<<endl;
}
}
}
{ // check to see if 3rd was the highest
if(hyt3 > hyt1 && hyt3 > hyt2)
{
if(hyt1 > hyt2) //if it is, then check to see where 1 and 3 placed
{
cout << " " << name << "'s best times are as follows: \n";
cout << hyt3 <<('\t') << ('\t') << d3<<"/"<<m3<<"/"<<y1<<endl;
cout << hyt1 <<('\t') << ('\t') << d1<<"/"<<m1<<"/"<<y1<<endl;
cout << hyt2 <<('\t') << ('\t') << d2<<"/"<<m2<<"/"<<y2<<endl;
}
else
{
cout << " " << name << "'s best times are as follows: \n";
cout << hyt3 <<('\t') << ('\t') << d3<<"/"<<m3<<"/"<<y1<<endl;
cout << hyt2 <<('\t') << ('\t') << d2<<"/"<<m2<<"/"<<y2<<endl;
cout << hyt1 <<('\t') << ('\t') << d1<<"/"<<m1<<"/"<<y1<<endl;
}
}
}
else
{
cout << " That height is invalid.";
}
}
}
system("PAUSE");
return EXIT_SUCCESS;
}
|