Can anyone tell me how to get this while loop to iterate. I know it has to do with the way it is reading the if statement, but I am not sure how to fix it. Instead of using the logic and saying "type is != to 't' so I will continue on with the loop", it acts as though it skips the line with the if statement and goes directly to the "break" line.
<code>
cout << "Lumber Calculator" << endl << endl << "Available type codes: ""P"" for pine , ""F"" for fir, ""C"" for cedar, ""M"" for maple, \n and ""O"" for oak. Press ""T"" for total." << endl
<< "Use type quantity width height length format. (i.e. P 10 2 4 8)" << endl << endl;
cout << "Enter first item: ";
cin >> type >> quantity >> width >> height >> length;
As vargoal says, you're using an assignment operator '=' instead of a comparison one '=='.
That part of the if condition is saying "assign type the value 'T' and check the result. The result will be 'T', which is non-zero and so will be interpreted as 'true'.
The 'or' part of the if condition just says 't', which is the value 't' and, as before, will evaluate to true (non-zero).
What you've written is "if (true or true)" with a side-effect of assigning type the value 'T'.
What you need to write is if (type == 'T' || type == 't').
Better still, you should place the constant value on the left-hand-side of the expression, then the compiler will catch these sorts of mistakes for you ...
if ('T' == type || 't' == type)
If you used an '=' by mistake there, the compiler would complain that you can't assign 'T' (a constant) the value of type.
You could also look into using toupper() and only checking against 'T' ...