Section One BBS

Welcome, Guest.


Subject: pascal question Date: Fri Jun 17 2016 10:08 am
From: Gryphon To: dream master

On 06/17/16, dream master said the following...
 
 dm> ok for some reason in my lemonade igm for darkness the atm is not
 dm> working. here is the code:

 dm> procedure atm;
 dm> var
 dm> a, b, c, d : longint;
 dm>  input : string;
 dm> begin
 dm> header;
 dm> coutln('  credits on hand : '+itos(players.pcredits));
 dm> coutln('  credits in bank : '+itos(players.pcreditsbank));
 dm> coutln('');
 dm> cout('    how much would you like to withdraw? : ');
 dm> input := instr('',10,true);
 dm> if stoi(input) <> players.pcreditsbank then
 dm> coutln('   invalid entery');pause;exit;
 dm> a := players.pcreditsbank - stoi(input);
 dm> players.pcreditsbank := a;
 dm> b := players.pcredits + stoi(input);
 dm> players.pcredits := b;
 dm> coutln('   thank you transaction closed....');
 dm> savep(currentp);
 dm> pause;
 dm> exit;
 dm> end;

You don't have your if statement grouped in the begin/end clause.  I'm
guessing what's happening is you are getting that after the input, it's doing
a pause, then exiting, right?

This:
if stoi(input) <> players.pcreditsbank then
coutln('   invalid entery');pause;exit;

Needs to be:
if stoi(input) <> players.pcreditsbank then begin
coutln('   invalid entry');pause;exit;end;

 "No matter where you go, there you are!" - Buckaroo Bonzai

--- Mystic BBS v1.12 A20 (Raspberry Pi)
 * Origin: Cyberia BBS | Cyberia.Darktech.Org | Kingwood, TX (44:100/4)

Previous Message       Next Message
In Reply To: pascal question (dream master)
Replies: pascal question (dream master)pascal question (dream master)