// pg 107 exercise 2
#include <iostream>
#include <cmath>
using namespace std;
float FeetToInches(int,int);
float PoundsToKilos(int);
float ConvertBmi(float,float);
int main();
{
int feet;
int inches;
int pounds;
cout << " Please enter your height in feet." << endl;
cin >> feet;
cout << " Please enter your height in inches." << endl;
cin >> inches;
cout << " Please enter your weight in pounds."<< endl;
cin >> pounds;
float inMeters = FeetToInches(inches,feet);
float inKilos = PoundsToKilos(pounds);
float bmi = ConvertBmi(inKilos,inMeters);
return 0;
}
float FeetToInches(int inch,int ft)
{
const int toInches = 12;
int totalInches = inch + (ft* toInches); //convert to total inches
const float toMeters = 0.0254; //convert totalinch to kilo
float Meters = totalInches * toMeters;
return Meters;
}
float PoundsToKilos(int lbs)
{
const float ToKilos = 2.2; // pounds to kilos
float converted = lbs / 2.2 ;
return converted;
}
float ConvertBmi(float kilo,float mtrs) // calculate bmi
{
float bmi = kilo / sqrt(mtrs);
return bmi;
}
thanks very much guys, girls works now
any help would be greatly appreciated if anyone can help me with the compile errors in this code. please. Next time ill post the errors it works now thanks.
[Edited by - derekpainter1 on July 3, 2006 4:50:49 PM]
int main();
{
(the semicolon shouldn't be there)
Also, you have a few conversion warnings that you may want to address. Next time, please post the errors you are getting.
jfl.
{
(the semicolon shouldn't be there)
Also, you have a few conversion warnings that you may want to address. Next time, please post the errors you are getting.
jfl.
"thanks very much guys, girls works now"
What an interesting description of a problem.
When someone helps you, you make another post to notify him that the problem is fixed and thank him. You don't edit your original post and change the title of the thread,thus making it useless for everyone else. Geez.
What an interesting description of a problem.
When someone helps you, you make another post to notify him that the problem is fixed and thank him. You don't edit your original post and change the title of the thread,thus making it useless for everyone else. Geez.
Quote:Original post by mikeman
"thanks very much guys, girls works now"
What an interesting description of a problem.
When someone helps you, you make another post to notify him that the problem is fixed and thank him. You don't edit your original post and change the title of the thread,thus making it useless for everyone else. Geez.
Only in the U.S [grin]
At first I thought this was another girl thread but then I was like, "Why isn't it in the lounge???". Lol. It's just that I interpreted that "girls" work now, and before the help they didn't.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement