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:
program sequence; uses wincrt; var price,count,pre_sum,new_sum,sum,new_price:integer;product:string; Begin count:=1; readln(Product); readln(Price); While price<>0 do Begin readln(Product); readln(Price); sum:=Price+Price; count:=count+1; Writeln('Grand Total: ',sum); Writeln('The number of items purchased is ',count); End; End.
Edited by pritaeas: Added markdown