//---------------------------------------------------- // Edward Cory ID#: 10164771 // epcr2f@umr.edu CS53 HW #3 // FILENAME: hw3.cpp //---------------------------------------------------- // Description: // This program receives information on the users age // weight, and height then transfers the information // to their hat, jacket and waist size. //---------------------------------------------------- #include using namespace std; int iWeight, iHeight, iAge, ys_input; char cCh; float hat_size(int iWeight, int iHeight); float jacket_size(int iHeight, int iWeight, int iAge); float waist_size(int iWeight, int iAge); bool yes_input(char cCh); int main() { do { // Input the variables cout << endl << "Enter your height in inches: "; cin >> iHeight; cout << "Enter your weight in pounds: "; cin >> iWeight; cout << "Enter your age in years: "; cin >> iAge; // Call the functions to calculate hat, jacket and waist size cout << endl << "Your hat size is: " << hat_size(iWeight, iHeight); cout << endl << "Your jacket size is: " << jacket_size(iHeight, iWeight, iAge); cout << endl << "Your waist size is: " << waist_size(iWeight, iAge) << endl; cout << endl << "Do you want to calculate for another person? Type Y or N " << endl; cin >> cCh; yes_input(cCh); } while (ys_input==1); return 0; } float hat_size(int iWeight, int iHeight) { float hat_siz; // This function calculates the hat size hat_siz = (iWeight / iHeight) * 2.9; return hat_siz; } float jacket_size(int iHeight, int iWeight, int iAge) { float jacket_siz; // This function calculates the jacket size int ilocal_Count; jacket_siz = (iHeight * iWeight) / 288; for ( ilocal_Count=40 ; ilocal_Count > iAge ; ilocal_Count = ilocal_Count + 10) { if (iAge >= ilocal_Count) jacket_siz = jacket_siz + 1/8; } return jacket_siz; } float waist_size(int iWeight, int iAge) { float waist_siz; // This function calculates the waist size int ilocal_Count=30; waist_siz = (iWeight / 5.7); // For whatever reason, the compiler misses this while loop // I have tried numerous ways to fix it, but none work. // I would appreciate some commenting as to why only this // part of the program that does not work 100%... while (ilocal_Count <= iAge) { waist_siz = waist_siz + 0.1; ilocal_Count = ilocal_Count + 2; }; // End of area compiler misses... :confused: return waist_siz; } bool yes_input(char cCh) { // This function finds if the user wants to repeat or not ys_input = 0; if (cCh == 'Y') ys_input = 1; if (cCh == 'y') ys_input = 1; return ys_input; }