Lol, you're making this very difficult on me, because i'm new the forum and know they don't like giving away the direct answers because this forum does not condone cheating on homework and I agree.. so I am going to re-phrase this the best I can.
Remember C++ reads top down.. as you either did not quite understand how to or did not open up a notepad and type out exactly what you saw....I am going to emulate this...I will not provide any further code instruction because from here on out I believe i WILL give you the answer if i do.. but I will show you the novice diagnosis technique I have been using when i get either get compile errors or segmentation faults 20 times in a row (I'm not even as far as you, I don't use classes yet, this is just math and logic, so you will get it )
The first segment of [code] here will be your while loop, the second will be my "notepad" illustration
Code:
cout << "Enter item ordered [A/B/C/D] or T to calculate total: ";
cin >> comboType;
comboType = toupper(comboType);
while (comboType != 'T')
{
cout << "Enter item ordered [A/B/C/D] or T to calculate total: ";
cin >> comboType;
orderTotal += comboPrice;
switch (comboType)
{
case 'A':
comboPrice = 4.25;
break;
case 'B':
comboPrice = 5.75;
break;
case 'C':
comboPrice = 5.25;
break;
case 'D':
comboPrice = 3.75;
break;
//end switch
}
// end while
}
Start -> Run -> Notepad
Code:
"Enter item ordered[A/B/C/D] or T to calculate total:"
Read what was typed in to comboType
So long as comboType does not equal the letter 'T' do the following...
"Enter item ordered[A/B/C/D] or T to caculate total:"
Read what was typted in and store it in variable comboType
ordertotal(0.0) = orderder(0.0) + comboprice(0.0)
(or)
add comboprice(0.0) to ordertotal(0.0)
NOW what does A B C D mean?
A4.25
B5.75
C5.25
D3.75
did they enter T as the input?
Yeah? Ok, Tell me how much they owe ( Ordertotal)
The main thing I want you to look at here, is your first calculation, the first time that ordertotal is calculated, think of what it would be missing by you having this calculating this early..and think of the EXACT amount your current program result is short of what it should be.
.... Gods of this forum..please don't ban me...I know that was too much