Board index » delphi » TP7 Error - Newbie needs help!

TP7 Error - Newbie needs help!

We have just started Pascal programming lessons at college & am having trouble running this program at home. I am using the same
version of TP7 at home/college. I keep getting Error 200 when I try and run it (Division By Zero).

My code is below, its just a simple adding program - can anyone get this to run please?

Thanks,
Gemma

-----

program adder;
{ Author: Gemz
  Description: My Adding Program
  Date:  January/February 2001 }

uses crt;

var user_name : string[20];
    num1      : integer;
    num2      : integer;
    answer    : integer;
    go_on     : char;

procedure B1_COLS;
begin
  textbackground(black);
end;

procedure B2_USER;
begin
  clrscr;
  textcolor(red);
  gotoxy(19,3);
  writeln('Gemziz Adder Program');
  gotoxy(19,6);
  write('User name - [                    ]');
  gotoxy(19,8);
  write('Number 1  - [     ]');
  gotoxy(19,10);
  write('Number 2  - [     ]');
  gotoxy(19,12);
  write('Answer    - [     ]');
  textcolor(yellow);
  gotoxy(32,6);
  readln(user_name);
  go_on:='y'
end;

procedure B3_DATA;
begin
  gotoxy(32,8);
  writeln('    ');
  gotoxy(32,10);
  writeln('    ');
  gotoxy(32,12);
  writeln('    ');
  gotoxy(32,8);
  readln(num1);
  gotoxy(32,10);
  readln(num2);
end;

procedure B4_CD;
begin
  answer:=num1+num2;
  gotoxy(32,12);
  writeln(answer);
  gotoxy(14,15);
  writeln('Would you like to use this program again (y/n)? ');
  go_on:=readkey;
  gotoxy(14,15);
  writeln('                                                ');
end;

procedure A1_INIT;
begin
  B1_COLS;
  B2_USER;
end;

procedure A2_MAIN;
begin
  B3_DATA;
  B4_CD;
end;

procedure A3_CLOSE;
begin
  textcolor(white);
  gotoxy(14,15);
  writeln('Hope you found this useful, ', user_name, '. (Press enter)');
  readln;
end;

begin
  A1_INIT;
  while(go_on='y') do A2_MAIN;
  A3_CLOSE;
end.

 

Re:TP7 Error - Newbie needs help!


Quote
* Gemz * wrote:

> We have just started Pascal programming lessons at college & am having trouble running this program at home. I am using the same
> version of TP7 at home/college. I keep getting Error 200 when I try and run it (Division By Zero).

This is, of course, a FAQ, and a web search would have answered your
question right away.

Quote
> My code is below, its just a simple adding program - can anyone get this to run please?

<snip>

> uses crt;

<snip>

Hint: This is the offending line.

Al Moore

Re:TP7 Error - Newbie needs help!


#This is, of course, a FAQ, and a web search would have answered your
#question right away.

Well, I am sorry I'm sure! ;)

My tutor told us we *HAVE* to put that crt line in...?

Re:TP7 Error - Newbie needs help!


"* Gemz *" <n...@nooo.com> wrote in message
news:Uyzi6.7588$mO6.144016@news6-win.server.ntlworld.com...

Quote
> #This is, of course, a FAQ, and a web search would have answered
your
> #question right away.

> Well, I am sorry I'm sure! ;)

> My tutor told us we *HAVE* to put that crt line in...?

But the problem is that BP7's CRT has a bug which makes it fall over
on anything faster than a Pentium 200 or thereabouts. The CPU is just
too fast.

You only need CRT if you want to use things like GotoXY, TextColor and
so on. It is possible to write Pascal programs without using CRT. But
not easy to make them colourful, unless you have an alternative unit.

There is an alternative CRT unit, from Pedt Scragg, if you can talk
your tutor into using it.

Alternatively, as Al said, do a web search for one of the many patches
for this bug (e.g. BP7PATCH), and fix your own CRT unit.

FP

Re:TP7 Error - Newbie needs help!


JRS:  In article <3A8AC231.6...@lmco.com>, seen in
news:comp.lang.pascal.borland, A. Moore <alan.mo...@lmco.com> wrote at
Wed, 14 Feb 2001 09:36:49 :-

Quote
>* Gemz * wrote:

>> We have just started Pascal programming lessons at college & am having trouble
>running this program at home. I am using the same
>> version of TP7 at home/college. I keep getting Error 200 when I try and run it
>(Division By Zero).

>This is, of course, a FAQ, and a web search would have answered your
>question right away.
> ...

Be aware that a Web search would have found many answers, some worth
finding, some not; the distinction may not be obvious.

It's best IMHO to recommend this group's mini-FAQ, and to give one of
its locations (e.g. as below).

Pedt: therein, http://www.merlyn.demon.co.uk/pas-time.htm#Delay should
now be http://www.merlyn.demon.co.uk/pas-wait.htm#Delay - though to fit
the preceding words, perhaps
"via http://www.merlyn.demon.co.uk/pascal.htm" ?

--
? John Stockton, Surrey, UK.  j...@merlyn.demon.co.uk   Turnpike v4.00   MIME. ?
 <URL: http://www.merlyn.demon.co.uk/> TP/BP/Delphi/&c., FAQqy topics & links;
 <URL: http://www.merlyn.demon.co.uk/clpb-faq.txt> Pedt Scragg: c.l.p.b. mFAQ;
 <URL: ftp://garbo.uwasa.fi/pc/link/tsfaqp.zip> Timo Salmi's Turbo Pascal FAQ.

Re:TP7 Error - Newbie needs help!


you must download a program which corrects this error on compiled *.exe
file..

In article <Uyzi6.7588$mO6.144...@news6-win.server.ntlworld.com>,
n...@nooo.com says...

Quote
> #This is, of course, a FAQ, and a web search would have answered your
> #question right away.

> Well, I am sorry I'm sure! ;)

> My tutor told us we *HAVE* to put that crt line in...?

Re:TP7 Error - Newbie needs help!


JRS:  In article <MPG.14f9135b542ce25c989...@snews.apol.com.tw>, seen in
news:comp.lang.pascal.borland, swizard <a...@atom.com> wrote at Sat, 17
Feb 2001 23:10:05 :-

Quote
>you must download a program which corrects this error on compiled *.exe
>file..

Incorrect.  That is well known not to be necessary, and is, at least
often, not the best approach.

--
? John Stockton, Surrey, UK.  j...@merlyn.demon.co.uk   Turnpike v4.00   MIME. ?
 Web <URL: http://www.merlyn.demon.co.uk/> - FAQish topics, acronyms, & links.

    Never fully trust an article from a poster who gives no full real name.

Other Threads