Can someone help with my Pascal????


PROGRAM Store (INPUT, OUTPUT);
VAR
Change, AmountPaid, TotalPrice :REAL;
IntChange, Dollars, Quarters, Dimes, Nickels, Cents :INTEGER;
BEGIN
WRITE('Enter the total-price in dollars:');
READLN(Totalprice);
WRITE('Enter the amount-paid in dollars:');
READLN(AmountPaid);
{ Dollars }
Change := AmountPaid - Totalprice;
Dollars := TRUNC(Change);
Change := (Change - Dollars)*100;
IntChange := ROUND(Change);
{ Quarters }
Quarters := IntChange DIV 25;
IntChange := IntChange MOD 25;
{ Dimes }
Dimes := IntChange DIV 10;
IntChange := IntChange MOD 10;
{ Nickels }
Nickels := IntChange DIV 5;
IntChange := IntChange mod 5;
{ Cents }
Cents := IntChange;
WRITELN('The Change is: ');
WRITELN('Dollars,'Dollars');
WRITELN('Quarters,'Quarters');
WRITELN('Dimes,'Dimes');
WRITELN('Nickels,'Nickels');
WRITELN('Cents,'Cents');
READLN;
END.

It just wont execute can someone please help me?

Thanks in advanced! :)

Comments

  • : It just wont execute can someone please help me?


    Add what's [b][green]green[/b] and delete what's [b][red]red[/b][code]
    : WRITELN('Dollars,'[green],[/green]Dollars[red]'[/red]);
    : WRITELN('Quarters,'[green],[/green]Quarters[red]'[/red]);
    : WRITELN('Dimes,'[green],[/green]Dimes[red]'[/red]);
    : WRITELN('Nickels,'[green],[/green]Nickels[red]'[/red]);
    : WRITELN('Cents,'[green],[/green]Cents[red]'[/red]);

    [/code]

  • When you use write look at the text as a string 'value' thats why we need ' '.
    Each variable is separated with , except last one so you have
    Write (a, b, 'text', c);
    or
    write ('text', a);
    or variable in the middle
    write ('text', a, 'text');
    got this and you will make less misstakes
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories