Hello jvxn21,
It took me a while to figure out the very first if statement needs "wallSize" of 318 and "trim" of "302" for the rest to work.
I only worked with the "4X7" because it was several lines into the input file. What I found is that lines 82 and 83 need to come after line 80. Otherwise it prints every line read from the file.
Some hints/suggestions:
Calling the input stream "read" may seem reasonable at first, but it gave me the wrong impression, as in you were trying to read a binary file. A name that is more descriptive would be "inFile" or the opposite "outFile". It makes the code easier to understand.
Your use of setprecision is redundant. This only needs to be done once and I put it about line 49 as:
std::cout << std::fixed << std::showpoint << std::setprecision(2);
. The "showpoint" allows ".00" to be displayed otherwise it is left off.
A suggestion for testing the program:
int wallSize = int(318);
string trim = string("302");
string df = string("4X7");
string ano = string("CC");
double multiplier = double(2);
|
And give them a value. Then comment out the lines 36 - 48 and you can test the program without having to enter each field when the program runs.
I like to set up the input as:
1 2
|
cout << "What is your multiplier? ";
cin >> multiplier;
|
Notice that the "cout" statement has a space before the closing quote and the "endl" is missing. this allows the "cin" to be on the same line. To me it is a cleaner way of doing input rather than having the cursor just hanging there on the next line.
Instead of relaying on the user to enter a capital when needed you might want to consider a function, using "std::toupper()", header file "cctype", to make sure every letter input is in upper case.
Hope that helps,
Andy