1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
|
/*
this program will calculate and display a user's clothing size
based off the user input of height, weight and age
the output will be hat, jacket, and waist size
*/
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
/** hatSize will take in 2 arguments
will divide the 2 arguments and multiply them by 2.9
*/
int hatSize (int lbs, double length);
/** jacketSize will take in 3 arguments
the first two arguments will be multiplied and then divided by 288
.125 will be added if third argument is higher than variable time
*/
double jacketSize (double length, double waist, int time);
/** waist size will take in 2 arguments
the first will be divided by 5.7
than if the age is over 28
.10 will be added for every 2 years
*/
double waistSize (double lb, int time);
int main()
{
double height;
int age , weight;
char userInput;
do
{
cout << "_____________Welcome______To______Your_______True________Fit________\n\n\n";
cout << " How tall are you in inches??" << endl;
cin >> height;
cout << " what is your current weight?? no cheating" << endl;
cin >> weight;
cout << " How many years young are you??" << endl;
cin >> age;
cout << " \n\n\n You should look for a size " << hatSize(weight, height)
<< " in hats." << endl ;
cout << fixed << setprecision(2);
cout << " Your jacket should give your chest at least "
<< jacketSize (height, weight, age) << " of inches around. " << endl;
cout << " Based off your weight, you should have "
<< waistSize(weight, age) << " inches around your waist " << endl;
cout << " Would you or anyone else like to find their true fit?? (y/n) " << endl;
cin >> userInput;
if (userInput != 'y' || userInput != 'Y') // to have the user try again
{
cout << " Awww well me know if you change your mind. (y/n)";
}
}while (userInput == 'y' || userInput == 'Y' ); // loop until the user ends the loop
return 0;
}
/** waist size will take in 2 arguments
the first will be divided by 5.7
than if the age is over 28
.10 will be added for every 2 years
*/
double waistSize (double lb, int time)
{
double waist;
waist = lb / 5.7;
if (time > 28)
{
for (int i = 0; i <= time; i += 2)
{
waist += .10;
}
}
return waist;
}
// receiving height and weight to give size
// time is from the age variable
double jacketSize (double length, double lb, int time)
{
double coat;
coat = (length * lb) / 288;
if ( time > 30) // if the person is older than 30
{
for (int i = 0; i <= time; i += 10) // adding .125 to coat for every 10 years
{
coat += .125;
}
}
return coat;
}
//
int hatSize (int lbs, double length)
{
double headSize;
headSize = (lbs / length) * 2.9;
return headSize;
}
|