J
jienweiwu
The following is correct...
#include <iostream>
using namespace std;
int main()
{
double BMI,height,weight;
cout<<"Welcome to the BMI calculator!\n\n";
cout<<"Enter your weight(kilos): ";
cin>>weight;
cout<<"Enter your height(meters): ";
cin>>height;
BMI = weight/height/height;
cout<<"BMI: "<<BMI<<endl ;
if ( BMI > 34.9)
cout<<"é‡åº¦è‚¥èƒ–";
else
if (BMI>29.9)
cout<<"ä¸åº¦è‚¥èƒ–";
else
if (BMI>26.9)
cout<<"輕度肥胖";
else
if (BMI>23.9)
cout<<"éŽé‡";
else
if (BMI>=18.5)
cout<<"é©ä¸";
else
cout<<"éŽè¼•";
system("pause");
return 0;
}
The following is wrong...
#include <iostream>
using namespace std;
int main()
{
double BMI,height,weight;
cout<<"Welcome to the BMI calculator!\n\n";
cout<<"Enter your weight(kilos): ";
cin>>weight;
cout<<"Enter your height(meters): ";
cin>>height;
BMI = weight/height/height;
cout<<"BMI: "<<BMI<<endl ;
if ( BMI > 34.9)
cout<<"é‡åº¦è‚¥èƒ–";
else
if (34.9>=BMI>29.9)
cout<<"ä¸åº¦è‚¥èƒ–";
else
if (29.9>=BMI>26.9)
cout<<"輕度肥胖";
else
if (26.9>=BMI>23.9)
cout<<"éŽé‡";
else
if (23.9>=BMI>=18.5)
cout<<"é©ä¸";
else
cout<<"éŽè¼•";
system("pause");
return 0;
}
BUT WHY CAN'T THE SECOND ONE FUNCTION??
#include <iostream>
using namespace std;
int main()
{
double BMI,height,weight;
cout<<"Welcome to the BMI calculator!\n\n";
cout<<"Enter your weight(kilos): ";
cin>>weight;
cout<<"Enter your height(meters): ";
cin>>height;
BMI = weight/height/height;
cout<<"BMI: "<<BMI<<endl ;
if ( BMI > 34.9)
cout<<"é‡åº¦è‚¥èƒ–";
else
if (BMI>29.9)
cout<<"ä¸åº¦è‚¥èƒ–";
else
if (BMI>26.9)
cout<<"輕度肥胖";
else
if (BMI>23.9)
cout<<"éŽé‡";
else
if (BMI>=18.5)
cout<<"é©ä¸";
else
cout<<"éŽè¼•";
system("pause");
return 0;
}
The following is wrong...
#include <iostream>
using namespace std;
int main()
{
double BMI,height,weight;
cout<<"Welcome to the BMI calculator!\n\n";
cout<<"Enter your weight(kilos): ";
cin>>weight;
cout<<"Enter your height(meters): ";
cin>>height;
BMI = weight/height/height;
cout<<"BMI: "<<BMI<<endl ;
if ( BMI > 34.9)
cout<<"é‡åº¦è‚¥èƒ–";
else
if (34.9>=BMI>29.9)
cout<<"ä¸åº¦è‚¥èƒ–";
else
if (29.9>=BMI>26.9)
cout<<"輕度肥胖";
else
if (26.9>=BMI>23.9)
cout<<"éŽé‡";
else
if (23.9>=BMI>=18.5)
cout<<"é©ä¸";
else
cout<<"éŽè¼•";
system("pause");
return 0;
}
BUT WHY CAN'T THE SECOND ONE FUNCTION??