Questions tagged [turbo-pascal]

Turbo Pascal is an old software development system including a compiler and an integrated development environment for the Pascal programming language running on CP/M, CP/M-86, and DOS.

115 questions
1
vote
2 answers

From language POV, should Succ/Prev be applicable to pointers?

I wonder if Succ/Prev intrinsics should be able to be used over typed pointer types. Just like Inc/Dec and maths ( PointerVar+1 and PointerVar-1…
Arioch 'The
  • 15,799
  • 35
  • 62
1
vote
1 answer

How to make a loop that uses 3 of indexes each iteration without specifying last two iterations in turbo-pascal?

I have an array with PointType objects: const coords : array[0..6] of PointType = ((x:220, y:410), (x:120, y:110), (x:480, y: 60), (x:320, y:200), (x:560, y:190), (x:390, y:360), …
Artem Ilin
  • 353
  • 2
  • 19
1
vote
2 answers

Is it possible to turn a statement into a expression?

In C, you can assign two variables in one line with b = a = sqrt(10); In Delphi b := a := Sqrt(10); is not allowed. With IfThen, there is an "alternative" for the ternary operator ?: as discussed in Delphi - Equivalent to C#'s ternary operator? In…
finefoot
  • 9,914
  • 7
  • 59
  • 102
1
vote
1 answer

Arithmetic Operation on a string

I have a task in my school extraculicular. my task is to create a calculator that can run with 1 input. example, input: 3+7+1*2 and the output will be 12 like that, how to create that? i have search in google to create calculator but all of them…
1
vote
2 answers

i don't know why the program didn't run

Please tell me where am i wrong, i couldn't fine my mistake in 2 programs. I try to use recursive in pascal. This one is running but it gives me wrong resuts program fatorial; var n: integer; function f(n: longint): longint; begin if((n=0) or…
HKS
  • 167
  • 1
  • 2
  • 10
1
vote
1 answer

Change screen color using assembly in Turbo Pascal

I have problems with the syntax in turbo pascal, this in debug works with no problem, but I can't make it work in Turbo Pascal. program foo; begin asm mov ah,06h; mov bh,$21; mov cx,$0000; mov bx,$1950; int 10h; mov…
exsnake
  • 1,767
  • 2
  • 23
  • 44
1
vote
2 answers

turbo pascal remove second space from string

This seems simple to me, but I can't get my brain around it. I want to take a string, check for spaces, ignore the first space, but remove all subsequent spaces. For example: MyString := 'Alexander The Great'; Output would be 'Alexander…
1
vote
1 answer

How do i use multiple statements to one case statement?

So i'm using pascal, and i want to add multiple statements to one case. I tried this code but i get the error: "Error: Constant and CASE types do not match" procedure pay; begin loop:=loop+1; CASE loop OF 1: writeln('E-Mail:…
petie
  • 77
  • 3
  • 13
1
vote
1 answer

Count prime numbers from an array in Pascal

I have a problem in PAscal. I want to count prime numbers but no result : My code is: Program arrayToFunction; const size = 5; type a = array [1..size] of integer; var aNumbers: a = (1, 7, 3, 4, 5); iCountNumbers: integer; function…
Harea Costea
  • 275
  • 5
  • 19
1
vote
2 answers

How to insert the probability of randomizing a specific number in pascal

I've been trying lately to write a program(a text based game) but I only know some commands and don't understand every command very well. What I am trying to do is a hit chance. Lets say that I want the program to have 90% chance of choosing number…
1
vote
1 answer

The maximum in each row

I have a question for you. I need to write the maximum element in each line. For example, my table : 1 2 3 4 5 6 7 8 9 10 11 12 I want to get 4,8,12 I tried but no result: Program Lab2; type A=array[1..5,1..5] of integer; var…
user3348229
  • 27
  • 1
  • 7
1
vote
1 answer

How can I check if the mouse button is released, and THEN execute a procedure once in Borland Pascal 7.0?

I use Borland Pascal 7.0, and I would like to make a slots game (If 3 random numbers are the same, you win). The problem is that when I click on the start (Inditas) button on the menu, the procedure executes many times until I release the mouse…
Robert
  • 197
  • 11
1
vote
1 answer

How to read pointer variable value in Turbo Pascal?

I have the following code in Object Oriented Turbo Pascal (an example). And also, some questions for you guys, who have the knowledge of Turbo Pascal - because I can't find any answers. type PMyNumber =^TMyNumber; TMyNumber = object(TObject) …
Tony
  • 12,405
  • 36
  • 126
  • 226
1
vote
2 answers

External File Writing Not Completed

When I write to an external file in Pascal the external file is not written completely even though the coding was flawless. procedure save; {Menyimpan data penerbangan ke dalam file eksternal} begin write('> '); write('nama…
1
vote
1 answer

Write content of file into another file

So, i've faced this task. I wrote code, but somehow instead of putting content of file into another file2, it simply erase content of file2. What am i doing wrong? Program Lesson9_Program2; Var FName, Fname2, Txt, Txt2 : String; UserFile,…
Avdept
  • 2,261
  • 2
  • 26
  • 48