#include <iostream>
usingnamespace std;
int main()
{
//declaring variables
int weight;
float height;
cout << "Please key in the height followed by the weight: ";
cin >> height;
cout << "Please key in the weight: ";
cin >> weight;
// repeat untill height > 1.8
while (height < 1.8)
{
cout << "The height can not be less than 1.8: ";
cout << "Re-enter the height value: ";
cin >> height;
}
// repeat untill weight < 100
while (weight < 100)
{
cout << "The weight can not be more than 100: ";
cout << "Re-enter the weight value: ";
cin >> weight;
}
return 0;
}
#include <iostream>
usingnamespace std;
int main()
{
float height;
do
{
cout<<"Enter your height: " <<endl;
cin>>height;
if ( height < 1.8 )
{
cout<<"Height may not be under 1.8"<<endl;
cout<<"Please enter your height again: " <<endl;
cin>>height;
}
else
{
cout<<"Thank you for entering your height."<<endl;
}
}while ( height < 1.8 );
return 0;
}