| | |
Clothing size program has me racking my brain!
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Nov 2008
Posts: 1
Reputation:
Solved Threads: 0
Hello everyone, I am new to computer science, and thus far this semester I have not needed any help in writing a program even though I am stuck with a professor who struggles to get a clear point across. He is a great guy and tries to make sure we understand the material, but he is so comfortable with the stuff that he forgets we are entry level programmers!
Anyways, he recently gave us a program to write that involves functions and procedures in order to find clothing size. Here is the writeup he gave us for the program.
1) Write a C++ program to calculate a person's hat size, jacket size, and waist size using functions and procedures.
Hat size = weight in lbs divided by height in inches, and all of that multiplied by 2.9
Jacket Size = height in inches times weight divided by 288
waist in inches = weight in lbs divided by 4.9
2)The input of the program will be one of the following characters. H will indicate hat size, J will indicate Jacket size, and W will indicate waist in inches, then enter the weight, followed by the height in feet and inches.
So far this is what I have, and I am stuck!
Anyways, he recently gave us a program to write that involves functions and procedures in order to find clothing size. Here is the writeup he gave us for the program.
1) Write a C++ program to calculate a person's hat size, jacket size, and waist size using functions and procedures.
Hat size = weight in lbs divided by height in inches, and all of that multiplied by 2.9
Jacket Size = height in inches times weight divided by 288
waist in inches = weight in lbs divided by 4.9
2)The input of the program will be one of the following characters. H will indicate hat size, J will indicate Jacket size, and W will indicate waist in inches, then enter the weight, followed by the height in feet and inches.
So far this is what I have, and I am stuck!
C++ Syntax (Toggle Plain Text)
#include <iostream> using namespace std; void get_sentinel (char &); void get_data (int &, int &, int &); float Hat_Size (float, float, float); int Jacket_Size (int, int, int); int Waist_Size (int, int, int); int main() { int weight, height_in_feet, height_in_inches; float hat; int jacket, waist; get_data (weight, height_in_feet, height_in_inches); char method; return 0; } void get_data (int & weight, int & height_in_feet, int & height_in_inches) { cout << "Please enter your height in feet." << endl; cin >> height_in_feet; cout << "Please enter your height in inches." << endl; cin >> height_in_inches; cout << "Please enter your weight." << endl; cin >> weight; }
•
•
Join Date: Jan 2008
Posts: 3,819
Reputation:
Solved Threads: 501
•
•
•
•
Hello everyone, I am new to computer science, and thus far this semester I have not needed any help in writing a program even though I am stuck with a professor who struggles to get a clear point across. He is a great guy and tries to make sure we understand the material, but he is so comfortable with the stuff that he forgets we are entry level programmers!
Anyways, he recently gave us a program to write that involves functions and procedures in order to find clothing size. Here is the writeup he gave us for the program.
1) Write a C++ program to calculate a person's hat size, jacket size, and waist size using functions and procedures.
Hat size = weight in lbs divided by height in inches, and all of that multiplied by 2.9
Jacket Size = height in inches times weight divided by 288
waist in inches = weight in lbs divided by 4.9
2)The input of the program will be one of the following characters. H will indicate hat size, J will indicate Jacket size, and W will indicate waist in inches, then enter the weight, followed by the height in feet and inches.
So far this is what I have, and I am stuck!
C++ Syntax (Toggle Plain Text)
#include <iostream> using namespace std; void get_sentinel (char &); void get_data (int &, int &, int &); float Hat_Size (float, float, float); int Jacket_Size (int, int, int); int Waist_Size (int, int, int); int main() { int weight, height_in_feet, height_in_inches; float hat; int jacket, waist; get_data (weight, height_in_feet, height_in_inches); char method; return 0; } void get_data (int & weight, int & height_in_feet, int & height_in_inches) { cout << "Please enter your height in feet." << endl; cin >> height_in_feet; cout << "Please enter your height in inches." << endl; cin >> height_in_inches; cout << "Please enter your weight." << endl; cin >> weight; }
C++ Syntax (Toggle Plain Text)
float Hat_Size (float, float, float);
•
•
•
•
Hat size = weight in lbs divided by height in inches, and all of that multiplied by 2.9
![]() |
Other Threads in the C++ Forum
- Previous Thread: wont let me create a vector of my user defined class
- Next Thread: HashTable Implementation Revised
| Thread Tools | Search this Thread |
api array arrays based beginner binary c++ c/c++ calculator char char* class classes code compile compiler console conversion count delete deploy desktop directshow dll download dynamic dynamiccharacterarray encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker linux list loop looping loops map math matrix memory news number numbertoword output parameter pointer problem program programming project python random read recursion recursive reference return rpg sorting string strings struct temperature template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock wordfrequency wxwidgets






