The above code works as exected and gives the correct result (I have checked it with a BMI calculator on the web).Code:#include <iostream> using namespace std; short heightfeet {}; short heightinches {}; short weightpounds {}; float bmi{}; int main() { cout<<"Please enter your height in feet : "; cin>>heightfeet; cout<<"Now the extra inches : "; cin>>heightinches; cout<<"And finally your weight in pounds : "; cin>>weightpounds; bmi=(weightpounds/2.2)/ ((heightfeet*12+heightinches)* 0.0254))*((heightfeet*12+heightinches)* 0.0254); cout<<endl<<endl<<"Your BMI is : "<<bmi; cout<<endl<<endl<<endl<<"I thank you......"<<endl; cin.get (); cin.get (); return 0; }
My query is that my compiler gives an error warning as follows:
line 21 expected ';' before ')' token.
Can you please tell me why as it seems OK to me?



2Likes
LinkBack URL
About LinkBacks


