Im using an online executor. compileonline.com , so all i could see in the output was the "cout" and im not able to insert the answers/inputs :
So thanks to the help i got here before i was able to run these codes without error, BUT the ELSE statement i use to be supposed to show up when the two IF statements was not needed or rather when the requirements are met for the questions was not working (i think)
how should i put the else statement here corresponding to both the IF statements?
#include <iostream>
usingnamespace std;
int main()
{
int hb;
cout<<"Height of boy (in inches):\n";
cin>>hb;
int hg;
cout<<"Height of girl (in inches):\n";
cin>>hg;
int height;
height= (hb-hg);
if(height <= -2 || height >= 6)
cout<<"Somebody has to grow up."<<endl;
int wb;
cout<<"Weight of boy (in pounds): \n";
cin>>wb;
int wg;
cout<<"Weight of girl (in pounds): \n";
int weight;
weight=(wb-wg);
if (weight <=5 || weight >= 20)
cout<<"Somebody has to go on a diet."<<endl;
else
cout<<"You are both highly compatible.Go ahead and have a date."<<endl;
return 0;
}
if (weight <=5 || weight >= 20)
{ cout<<"Somebody has to go on a diet."<<endl;
compatible = false;
}
if (compatible)
cout << "You are both highly compatible.Go ahead and have a date." << endl;