Originally Posted by
Daved
Does your compiler give you a warning about the problem swoopy pointed out? Make sure to read and understand all the compiler warnings since they usually point out problems in your code.
Also,
Code:
while(x < 1)
{
if(itemStockNumber.size() == 4)
++x;
else
That is a convoluted way of making the loop. All you have to do is loop while itemStockNumber.size() != 4 (which is what Prelude's example did).
No, that part is fine, the only warning the compiler gives is:
Warning 1 warning C4244: 'return' : conversion from 'int' to 'float', possible loss of data h:\documents\c++\oop\program_5\program_5\program_5 .cpp 64
but I changed this:
Code:
setTotalValue(price, quantityInStock);
return quantityInStock;
Like you told me and it works, here is how it looks:
Code:
Please enter the item's stock number.
The item's stock number must be a four digit number: 7
The item's stock number must be a four digit number: 7
The item's stock number must be a four digit number: 545
The item's stock number must be a four digit number: 22
The item's stock number must be a four digit number: 7896
Please enter the price of item # 7896: 15.50
Please enter the quantity of item #7896: 65
Item #7896's price is $15.5 and has 65 items in stock.
The total value of the items is $1007.5
Press any key to continue . . .
Thanks EVERYONE for your help!!