Connecting Tech Pros Worldwide Forums | Help | Site Map

My pascal code wont compile

Newbie
 
Join Date: Oct 2009
Posts: 4
#1: 4 Weeks Ago
can someone help? Its the following code it just wont compile

thanks :)

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.



Newbie
 
Join Date: Oct 2009
Posts: 4
#2: 4 Weeks Ago

re: My pascal code wont compile


16 views and not 1 reply?
gits's Avatar
Moderator
 
Join Date: May 2007
Location: Munich, Germany
Posts: 4,134
#3: 4 Weeks Ago

re: My pascal code wont compile


i think you should fix the last lines:

Expand|Select|Wrap|Line Numbers
  1. WRITELN('The Change is: ');
  2. WRITELN('Dollars,'Dollars');
  3. WRITELN('Quarters,'Quarters');
  4. WRITELN('Dimes,'Dimes');
  5. WRITELN('Nickels,'Nickels');
  6. WRITELN('Cents,'Cents');
to something syntactically correct ones to compile :) ... and to something you want to have as output like:

Expand|Select|Wrap|Line Numbers
  1. WRITELN('The Change is: ');
  2. WRITELN('Dollars:', Dollars);
  3. WRITELN('Quarters:', Quarters);
  4. WRITELN('Dimes:', Dimes);
  5. WRITELN('Nickels:', Nickels);
  6. WRITELN('Cents:', Cents);
  7.  
kind regards
Newbie
 
Join Date: Oct 2009
Posts: 4
#4: 4 Weeks Ago

re: My pascal code wont compile


ah yes of course, wow i was looking at it for a long time sometimes i need a break i think :)
gits's Avatar
Moderator
 
Join Date: May 2007
Location: Munich, Germany
Posts: 4,134
#5: 4 Weeks Ago

re: My pascal code wont compile


that is a typical thing ... that's why we often use pair-programming here :)

kind regards
dheerajjoshim's Avatar
Needs Regular Fix
 
Join Date: Jul 2009
Location: Bangalore, INDIA
Posts: 261
#6: 2 Weeks Ago

re: My pascal code wont compile


Quote:

Originally Posted by gits View Post

that is a typical thing ... that's why we often use pair-programming here :)

kind regards

Wow pair programing? Interesting...

Regards
Dheeraj Joshi
gits's Avatar
Moderator
 
Join Date: May 2007
Location: Munich, Germany
Posts: 4,134
#7: 2 Weeks Ago

re: My pascal code wont compile


?? ... it's nothing very special ... pair programming is just one of the techiniques that might be used during software development ... by following the link you might see some advantages and disadvantages of that technique

kind regards
dheerajjoshim's Avatar
Needs Regular Fix
 
Join Date: Jul 2009
Location: Bangalore, INDIA
Posts: 261
#8: 2 Weeks Ago

re: My pascal code wont compile


Never worked in pair programming technique....

Lets see some where down the line i may get an opportunity...

Regards
Dheeraj Joshi
Reply


Similar Software Development bytes