#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

# I need help in Pascal

Member Posts: 2
Hello Word...

Hi my name is Daniela, I live in Venezuela....

My English is deficient, sorry me...

I need help about how to program in PASCAL:
1.- one program identify word palindrome or capicua
2.- one program identify Hight number and low number in one matrix defined by user.
3.- one program simulate game "la vieja" or "tree in line"

thank'

• : Hello Word...
:
: Hi my name is Daniela, I live in Venezuela....
:
: My English is deficient, sorry me...
:
: I need help about how to program in PASCAL:
: 1.- one program identify word palindrome or capicua
: 2.- one program identify Hight number and low number in one matrix defined by user.
: 3.- one program simulate game "la vieja" or "tree in line"
:
: thank'
:

Hi,

this not some kind of school's homework or so? ;-)

However, here are two examples. Please be warned, that I just wrote this code here - I didn't actually check it with pascal, so there might be some syntax errors!

---

This does not delete any spaces or commas, etc. Sometimes you have to do this too.

program PALI;

uses dos, crt;

var s : String;
a : Integer;

begin
for a:=1 to length(s) do begin
if (UPCASE(s[a]) <> UPCASE(s[length-a])) then begin
writeln('Nope! This is not a Palindrome!');
exit;
end;
end;
writeln('Wow! This is quite a cool Palindrome!');
end.

-----

To find a maximum in an array:

program MAXIMUS;

var arr : array[0..3,0..9] of Integer;
x, y : Integer;
max : Integer;

begin
{fill the array with values}

{...}

{now find the maximum}
max := arr[0,0];
for x:=0 to 9 do
for y:=0 to 3 do
if (arr[x,y] > max) then max := arr[x,y];
writeln('maximum is:',max);
end.

-----

I don't know what the "tree in line" is :-(

---

have fun!
tron.
• : : Hello Word...
: :
: : Hi my name is Daniela, I live in Venezuela....
: :
: : My English is deficient, sorry me...
: :
: : I need help about how to program in PASCAL:
: : 1.- one program identify word palindrome or capicua
: : 2.- one program identify Hight number and low number in one matrix defined by user.
: : 3.- one program simulate game "la vieja" or "tree in line"
: :
: : thank'
: :
:
: Hi,
:
: this not some kind of school's homework or so? ;-)
:
: However, here are two examples. Please be warned, that I just wrote this code here - I didn't actually check it with pascal, so there might be some syntax errors!
:
: ---
:
: This does not delete any spaces or commas, etc. Sometimes you have to do this too.
:
: program PALI;
:
: uses dos, crt;
:
: var s : String;
: a : Integer;
:
: begin
: for a:=1 to length(s) do begin
: if (UPCASE(s[a]) <> UPCASE(s[length-a])) then begin
: writeln('Nope! This is not a Palindrome!');
: exit;
: end;
: end;
: writeln('Wow! This is quite a cool Palindrome!');
: end.
:
: -----
:
: To find a maximum in an array:
:
: program MAXIMUS;
:
: var arr : array[0..3,0..9] of Integer;
: x, y : Integer;
: max : Integer;
:
: begin
: {fill the array with values}
:
: {...}
:
: {now find the maximum}
: max := arr[0,0];
: for x:=0 to 9 do
: for y:=0 to 3 do
: if (arr[x,y] > max) then max := arr[x,y];
: writeln('maximum is:',max);
: end.
:
: -----
:
: I don't know what the "tree in line" is :-(
:
: ---
:
: have fun!
: tron.
:

Maybe you've already mentioned, there is a logical error in the first example: It must go like this:

: if (UPCASE(s[a]) <> UPCASE(s[length(s)-a+1])) then begin

because starts with 1 and the last letter is s[length(s)].

tron.

• Member Posts: 0

__ / http://forcoder.org / free video tutorials and ebooks about | C# C++ R Scratch C Perl Go PL/SQL Delphi Objective-C Swift Java PHP JavaScript Visual Basic Python Assembly MATLAB Ruby Visual Basic .NET Prolog LabVIEW Fortran Kotlin FoxPro Lisp Hack VBScript Transact-SQL D Erlang Apex Lua Ada Awk COBOL Clojure F# Crystal Dart Alice ML Scheme SAS Bash Logo Julia Rust ABAP Scala | _______