Ok, so I got a program to do in TurboPascal but it's not doing the one of the requirements and I'm not sure how to get it so the question states: Write a program to read in the names of a sequence of products and their price. The program terminates when a 0 price is encountered for a product. The program should print the number of items purchased and a grand total. The data will be entered in the following order: Product,Price,Product,Price...
This is what I have so far:
While price<>0 do
Writeln('Grand Total: ',sum);
Writeln('The number of items purchased is ',count);
It's suppose to add all the prices together, but once i go more than 2 prices for 2 products, it gives me incorrect numbers, im trying to get a grand total each time a product is entered for eg. Ham-500,Chicen-500 Grand Total=1000 or Ham-500,Chicken,200,Rice-300...Grand Total=1000 but it just wont add the third price with the previously entered prices
Your idea worked!!! Just that it needed a bit of adjusting :D(initializing sum:=Price;before while) thanks much man thanks!!! If you have the time could you check out my other post? Title is "This doesn't make sense"... Thanks again.