Compare Heights
I'm having a problem with getting my program to compare the vaulters heights.
I know I need else if statements, but were do I go from there.
Thanks a bunch.
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
|
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
char vaulter[99];
double vheight1, vheight2, vheight3;
double date1, date2, date3;
// This is were you input the NAME, HEIGHT, and DATE of the vaulter.
cout << "What is the name of the pole vaulter.\n" ;
cin >> vaulter;
cout << "What is the FIRST height & date: " << endl;
cin >> vheight1;
cin >> date1;
cout << "What is the SECOND height & date: " << endl;
cin >> vheight2;
cin >> date2;
cout << "What is the THIRD height & date: " << endl;
cin >> vheight3;
cin >> date3;
if (vheight1 > vheight2 && vheight1 > vheight3)
{
}
else if (vheight1 < vheight2 && vheight1 < vheight3)
if (vheight2 > vheight1 && vheight2 > vheight3)
{
}
else if (vheight2 < vheight1 && vheight2 < vheight3)
if (vheight3 > vheight1 && vheight3 > vheight2)
{
}
else if (vheight3 < vheight1 && vheight3 < vheight2)
if (vheight1 && vheight2 && vheight3 <= 2.0 || vheight1 && vheight2 && vheight3 >= 5.0)
{
}
cout << "You need a number between 2.0 and 5.0.\n";
cout << "-----------------------\n";
cout << "Name: " << vaulter << endl;
cout << setprecision(1) << fixed << "1st: " << vheight1 << vheight2 << vheight3 << "On " << date1 << date2 << date3 << endl;
cout << setprecision(1) << fixed << "2nd: " << vheight1 << vheight2 << vheight3 << "On " << date1 << date2 << date3 << endl;
cout << setprecision(1) << fixed << "3rd: " << vheight1 << vheight2 << vheight3 << "On " << date1 << date2 << date3 << endl;
return 0;
}
|
Topic archived. No new replies allowed.