Ok so I wrote this program but its not compiling and Im havi
Ok so I wrote this program but it\'s not compiling and I\'m having a hard time figuring out why. It might just be somthing simple that I\'m missing but i don\'t know. I am using PuTTY as my compiler if that helps. Anyway the program asks for the user\'s height, weight, and age and then computes clothing sizes according to formulas.
So this is my program.
#include
#include
using namespace std;
double computeHatSize(int height, int weight);
double computeJacketSize(int height, int weight, int age);
double computeWaistSize(int weight, int age);
int main(){
double weight, height, hatSize, jacketSize, waistSize;
int age, answer;
//Get information for sizes//
cout << \"What is your height in inches?\";
cin >> height;
cout<< \"What is your weight in pounds?\";
cin >> weight;
cout<< \"What is your age in years?\";
cin >> age;
//Give output//
cout <<\"Your Hat size is \" << computeHatSize << endl;
cout <<\"Your jacket size is \" << computeJacketSize << endl;
cout <<\"Your waist size is \" << computeWaistSize << endl;
//Option to repeat
cout <<\"Do you want to repeat the program?\"<< endl;
cin >> answer;
}
string answer = \"yes\";
while (answer == \"yes\"){
return 0;
}
//Calculations//
double computeHatSize(int height, int weight);
{
return ((weight / height) * 2.9);
}
double computeJacketSize(int height, int weight, int age);
{
if ( age < 40 )
return (height * weight) / 288;
return ((height * weight) / 288) + ((1/8) * ((age - 40)/10));
}
double computeWaistSize(int weight, int age);
{
if ( age < 30 )
return weight / 5.7;
return (weight / 5.7) + ((1/10) * ((age - 30) / 2 ));
}
So I just need a little help finding out whats wrong with my program.
Thanks in advance
Solution
#include <iostream>
#include <string>
using namespace std;
double computeHatSize(int height, int weight);
double computeJacketSize(int height, int weight, int age);
double computeWaistSize(int weight, int age);
int main(){
double weight, height, hatSize, jacketSize, waistSize;
int age;
string answer;
do //do while loop to input values and compute Hat,Jacket and waist
{
//Get information for sizes//
cout << \"\ What is your height in inches?\";
cin >> height;
cout<< \"\ What is your weight in pounds?\";
cin >> weight;
cout<< \"\ What is your age in years?\";
cin >> age;
//Give output//
cout <<\"\ Your Hat size is \" << computeHatSize(height,weight) << endl;
cout <<\"\ Your jacket size is \" << computeJacketSize(height,weight,age) << endl;
cout <<\"\ Your waist size is \" << computeWaistSize(weight,age) << endl;
//Option to repeat
cout <<\"Do you want to repeat the program?\"<< endl;
cin >> answer;
if(answer == \"no\" || answer == \"NO\") //break if you don\'t want to repeat
break;
}while(answer != \"NO\" || answer ==\"no\");
return 0;
}
//Calculations//
double computeHatSize(int height, int weight)
{
return ((weight / height) * 2.9);
}
double computeJacketSize(int height, int weight, int age)
{
if ( age < 40 )
return (height * weight) / 288;
return ((height * weight) / 288) + ((1/8) * ((age - 40)/10));
}
double computeWaistSize(int weight, int age)
{
if ( age < 30 )
return weight / 5.7;
return (weight / 5.7) + ((1/10) * ((age - 30) / 2 ));
}
Output:
Success time: 0 memory: 3476 signal:0

