[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Using Turbo Pascal

Posted on 2003-11-11
5
Medium Priority
?
842 Views
Last Modified: 2008-02-26
Hello,
>I am new to Pascal programming and the Turbo Pascal compiler ver. 7.0. For
>a program I've compiled, an outline of the source code I'm using goes like this:-
>....
>BEGIN
>
>  Readln (some input);
>  some processing work...
>  Writeln:(some output);
>END;
>
>There's no problem with my source code, just that while running the
>program, after entering the input data, pressing carriage return wouldn't
>bring about the output supposed to be displayed on screen. Instead the
>program automatically terminates and I'll have to rerun the program again
>in order to view the output produced from my previous input. What should I need to do to remedy this problem? Thanks.
0
Comment
Question by:waifun
  • 2
  • 2
5 Comments
 
LVL 11

Expert Comment

by:bcladd
ID: 9727632
You are running inside the Turbo Pascal development environment? This has been a long time but there is a Windows menu and if you select the output window you should be able to look at it without rerunning the program. Try F5 (or was it Alt-F5...think that was launch shell commmand).

Alternative is to put a getch() command at the end of the program so the program doesn't terminate until you press another key. That way the output window retains the focus.

-bcl
0
 
LVL 1

Accepted Solution

by:
JackNaif earned 200 total points
ID: 9727687
getch()  mmmm that sounds like C language.

Before the last "end" put:

write('Any key to finish');
readkey; { You're going to look this one up in the help 'cause I can't remember in which unit it is, and I don't have TP here. }

Hope it helps.

Jack
0
 
LVL 11

Expert Comment

by:bcladd
ID: 9727722
ReadKey! That is it. Too long away from Pascal. It is in CRT in 5.5 (can't say for 7.0) and Alt-F5 is the output window toggle (had to fire up TP to see).

Brings back memories. Obviously _fuzzy_ memories but memories all the same.

Good catch, Jack.

-bcl
0
 
LVL 1

Expert Comment

by:JackNaif
ID: 9727775
Oh yes! That old and beloved blue screen with yellow chars!

So different from those other blue screens W95 got us used to! =)
0
 

Author Comment

by:waifun
ID: 9728952
To bcl,
It didn't work with getch()command though I didn't get any compiler's error messages. I have also tried Alt+F5 before but it just didn't work out the way I wanted.The idea with using Readkey was good as I just don't expect the window to disappear right away after typing in the input, before the output can be seen displayed.

Thanks alot...
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
If you haven’t already, I encourage you to read the first article (http://www.experts-exchange.com/articles/18680/An-Introduction-to-R-Programming-and-R-Studio.html) in my series to gain a basic foundation of R and R Studio.  You will also find the …
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
Suggested Courses
Course of the Month18 days, 7 hours left to enroll

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question