Here's the instructions:
Write a program that asks for the user's height, weight, and age and then computers the clothing sizes according to the formulas:
-Hat size = weight in pounds divided by the height in inches and all mutiplied by 2.9
- Jacket size ( chest in inches) = height times weight divided by 288 and then adjusted by adding 1/8 on an inch for each 10 years over age 30 ( Note that the adjustment only takes place after a full 10 years, So there is no adjustment for ages 30 through 39, bey 1/8 of an inch is added for the age 40 )
- Waist in inches = weight divided by 5.7 and then adjusted by adding 1/10 of an inch for each 2 years over age 28 ( Note that the adjustment only takes place after a full 2 years. So, there is no adjustment for ages 29, but 1/10 of an inch is added for age 30 )
Use functions for each calculation. Your program should allow the user to repeat the calculation as often as the user wishes.
My program
#include <iostream>
using namespace std;
double hatsize(double weight, double height);
double jacketsize(double weight, double height, int age);
double waistsize(double weight, int age);
when i run im getting error: binary not found first off and its marking a bunch of errors on the cout<< hat size/jacket/waist size in the intmain for the endl being overloaded and saying they cant be used as functions.
the other problem is in my long line of else ifs in the jacketsize function they are marked saying cant convert double to double.
sorry if its alot, im brand new to c++.
EDIT: here's the exact errors:
..\src\4.9 Programming Project.cpp:44: error: assignment of function `double jacketsize(double, double, int)'
..\src\4.9 Programming Project.cpp:44: error: cannot convert `double' to `double ()(double, double, int)' in assignment
..\src\4.9 Programming Project.cpp:45: error: cannot convert `double (*)(double, double, int)' to `double' in return
..\src\4.9 Programming Project.cpp: In function `double waistsize(double, int)':
..\src\4.9 Programming Project.cpp:50: error: assignment of function `double waistsize(double, int)'
..\src\4.9 Programming Project.cpp:50: error: cannot convert `double' to `double ()(double, int)' in assignment
..\src\4.9 Programming Project.cpp:52: error: assignment of function `double waistsize(double, int)'
..\src\4.9 Programming Project.cpp:52: error: cannot convert `double' to `double ()(double, int)' in assignment
..\src\4.9 Programming Project.cpp:53: error: cannot convert `double (*)(double, int)' to `double' in return
In both of these functions, you are using a variable name that is the same as that of your function and assigning it a value. Use a different variable name in the functions to get the information you need.
ex in jacketsize()
instead of jacketsize=((height*weight)/288); use a different variable instead of jacketsize