I'm supposed to make a program that will do 3 things with a menu
the first option is supposed to make a table of different lumber sizes (From 2 by 2 inches to 10 by 12 inches. The height increasing by 2's to 12 and then starting over again only with the next base number 2, to 4 to 6 to 8 to 10) along with their Cross Sectional Area, Moment of Inertia, and Section Modulus.
The Second Part is to do the computations of those only with custom mumbers.
The third seclection relates to the Moment of Inertia where the user has to input a Moment of inertia and a base and it should compute a height to match that base and Moment of Inertia.
for the second and third ones I also have to confirm that the user inputs only positive numbers and decimals. I also have to keep the numbers to about 3 decimal places.
The things I need help with are:
1. how to make the table in the program
2. How to make the menu visable because every time I ran it the menu doesn't show up.
My Code:
Code: Select all
///
///
///
/// Lumber Conversion
/// By: Wesley Montgomery
/// Date:
/// This program calculates the crosssectional area, the moment of inertia, and the sectional modulus of
/// a piece of wood.
///
///
///
#include <iostream>
#include <iomanip>
using namespace std;
int main ()
{
int lumbersizes, crosssectionarea, inertia, sectionmod, base, height, thirdheight;
bool done; //exit flag
char selection; //menu selection
done = false;
while (!done);
{
// Output menu list
cout << "\n\n";
cout << "************************\n\n";
cout << " Lumber Pack: \n";
cout << " 1) Lumber Size Chart\n";
cout << " 2) Custom base and Height Values chart\n";
cout << " 3) Moment of Inertia\n";
cout << " 4) Exit Program\n\n";
cout << "************************\n\n";
// Input data
cout << "Menu selection -> ";
cin >> selection;
cout << "\n\n";
//Process Input
if (selection=='1')
{
cout << "Under Construction." << endl;
} else if (selection=='2')
{
cout << "Enter Base of Lumber:" << endl;
cin >> base;
cout << "Enter Height of Lumber:" << endl;
cin >> height;
cout << "Cross sectional Area:" << endl;
crosssectionarea = base * height;
cout << crosssectionarea << endl;
cout << "Moment of Inertia:" << endl;
inertia = (base*(height*height*height))/12;
cout << inertia << endl;
cout << "Section Modulus:" << endl;
sectionmod = (base*(height*height))/6;
cout << sectionmod << endl;
}
else if (selection=='3')
{
cout << "Moment of Inertia\n\n";
cout << "Enter the Moment of Inertia and the base of the piece of lumber to try to match it:";
cout << "\n Moment of Inertia = ";
cin >> inertia;
cout << " Base = ";
cin >> base;
thirdheight = base*inertia / 12;
cout << "height:";
cout << thirdheight;
}
else if (selection=='4')
{
cout << "Goodbye.\n\n";
done = true; // flag for exit
}else
{
cout << "** Invalid Selection. **\n\n";
}
}// end of while loop
}
///End of Program