CheckEmoji Community · the emoji forum
🏠 Home 🆕 What's new ❓ Unanswered 🔥 Popular 📡 RSS Members 👥 0 online log in · register
Home › IT › Software › Pascal - Help - tutorial in English

Pascal - Help - tutorial in English

Started by Gary Turner96 · · 👁 4 views · 20 replies

📡 Subscribe to replies

Participants Gary Turner96wiredstag27urbanotter4
Gary Turner96 Gary Turner96 MemberOP
17 messages
joined Dec 2012
#1 ·
Hey, quick question—not sure if this has been covered yet, but I couldn't find anything! I really need a hand getting started with Pascal. I'm a total newbie here—like, I don't even know what the first thing you type is when you open the program (kind of like how you'd use QBasic CLS)—and I was wondering if there are any good tutorials out there in American English? If not, please, if anyone knows a killer English guide that explains the absolute basics—like the very first command you need to enter in Turbo Pascal and all that stuff—please let me know! I'm desperate... also, if anyone uses AOL Instant Messenger and feels like helping a beginner out, hit me up! 🙂 Thanks a bunch...
Gary Turner96 Gary Turner96 MemberOP
17 messages
joined Dec 2012
#2 ·
Man, it feels like everyone else gets an answer within like an hour—but here I am, stuck for over two hours without a single reply... am I seriously asking questions that hard? Or what?
wiredstag27 wiredstag27 Newcomer
2 messages
joined Sep 2014
#3 ·
If you're heading to school—go straight to the library and see if they have any books on Pascal available for checkout.
Once you're in, this is how the structure works:
program program_name;
uses crt; "this 'crt' part is just one example of a unit you can call—it’s used here to clear the screen"
var (a,b):integer; "this is where you declare variable types—for instance, integer for whole numbers, real for decimals, or char for characters. before the 'begin' statement, you list everything the program will use; you'll also include functions and booleans later on—things you don't need quite yet, but you definitely will soon"

begin
clrscr;
writeln
('Type some text to display on the screen'); "writeln handles printing to the screen, while readln handles keyboard input"
readln (a); "here you specify the variable where the user's input is stored—in this case, an integer—which you then use for calculations"
b:=a*a; "Pascal always evaluates the right side first—then assigns it to the left"
writeln (b); "this prints the result of squaring the number you entered"
readln; "we use readln here—simply so the program doesn't close instantly"
end.
This is the absolute beginning of it all.
wiredstag27 wiredstag27 Newcomer
2 messages
joined Sep 2014
#4 ·
So—what exactly are you trying to accomplish? I am feeling quite generous today—so tell me what you need.
Regarding the Google Help - tutorial.
If you find yourself needing loops...
for j:= 1 to 100 do
begin
command;
next command;
.
.
.
command;
end; "You have to declare 'j' as an integer—this is essential if you want to repeat something a specific number of times."
while condition do
begin
command;
.
.
command;
end; "Use this one when you have a certain condition—then perform these actions, for example."
repeat
command;
.
.
command;
until condition; "With this loop, you can solve most things—essentially, you have commands that execute until your specific condition is finally met."
But seriously—just tell me what you actually need to do.
Otherwise—you will find this incredibly difficult to grasp without a textbook or some more comprehensive text filled with examples.
Gary Turner96 Gary Turner96 MemberOP
17 messages
joined Dec 2012
#5 ·
My whole goal here is just to soak up as much knowledge as I can—plus, I'm trying to help out a friend who’s heading into a high school in downtown Chicago! She really needs to wrap her head around Pascal for some stuff, and since nobody else will step up to explain it... she’ll have 1 😢

EDIT :

program This_does_nuthin;

uses
Crt;

begin
{ Be sure to type this the same way you see it. }
Writeln('Wabba, wabba!');
end.
So, here's the code... I copied it exactly as it is, but it's totally broken! I even tried stripping out those brackets from the "be sure to..." part, but nothing works... I've tried everything, but whenever I hit RUN (ALT + F5), it just fails... and fails... all I get is a totally BLANK SCREEN...
wiredstag27 wiredstag27 Newcomer
2 messages
joined Sep 2014
#6 ·
program This_does_nuthin;
uses Crt;
begin
clrscr; (*Inside these brackets—this is where you put your comments—you write this so that the uses command works at the start, which clears the screen*)
Writeln ('Wabba, wabba!');
readln;
end.
Write this out in Pascal—then go to Compile and select compile from the menu—if there aren't any errors, just hit any key. Then head over to run and press run—and that’s it—just copy exactly what I wrote and read my previous message again; perhaps things will be clearer then.
wiredstag27 wiredstag27 Newcomer
2 messages
joined Sep 2014
#7 ·
Which school do you attend?
wiredstag27 wiredstag27 Newcomer
2 messages
joined Sep 2014
#8 ·
Forgive my intrusion—but your friend is headed to a different high school soon, and she surely spent time studying Pascal; yet, she somehow can't even write a basic program that any beginner would master. What on earth was she doing?😕
Gary Turner96 Gary Turner96 MemberOP
17 messages
joined Dec 2012
#9 ·
Man, I honestly have zero clue what she was actually doing... seriously, I'm clueless... ugh! She just popped up out of nowhere and said she needs everything by Friday if someone could walk her through it... 👏 👏 🙂She needs it by December 7th 😁
urbanotter4 urbanotter4 Newcomer
4 messages
joined Aug 2007
#10 ·
Gary Turner96 said:My whole goal here is just to pick up as much as I can so I can help out a friend. She’s heading into her sophomore year at some prep school in downtown Chicago and needs someone to walk her through Pascal because nobody else will bother... she'll have 1 😢

Oh, you wanna hit that. 😍 Look, this isn't some joke.😬

Listen, the best advice I can give you is to find someone nearby who actually knows Pascal and let them explain it to her. You trying to learn it all right now just so you can teach her? That's a nightmare. Especially if she’s already struggling with the class. It’s not rocket science, but trust me, explaining Pascal to someone who doesn't know the first thing about computers is a massive headache. What you're trying to do is basically impossible.

You can post the specific assignments she was given here and we might be able to write up the solutions for you, but let's be real—you don't just master Pascal overnight like any other coding language.
Gary Turner96 Gary Turner96 MemberOP
17 messages
joined Dec 2012
#11 ·
I know my way around QBasic, so I figured this might be something similar 🙂
urbanotter4 urbanotter4 Newcomer
4 messages
joined Aug 2007
#12 ·
It’s similar, sure, but there are all those tiny little nuances that actually matter—the kind of stuff you can't really move past until you've figured them out.
Gary Turner96 Gary Turner96 MemberOP
17 messages
joined Dec 2012
#13 ·
So I typed this out exactly how he told me—everything compiles perfectly... zero errors, right? But then I hit RUN and... nothing. Absolutely zilch.
wiredstag27 wiredstag27 Newcomer
2 messages
joined Sep 2014
#14 ·
I honestly don't see how that makes sense—I'm not even sure which version of Pascal you're running—though that shouldn't be an issue at all (mind you, some versions won't even launch unless you go file > Save as first). But look—if you actually want to get serious about programming, you really ought to pick up a Pascal textbook or maybe check one out in your school library. That was the easiest way for me to learn. I mean, if you get stuck on any homework assignments, we can certainly walk you through the logic, but sooner or later, you’re going to have to sit down and learn the fundamentals from scratch.
urbanotter4 urbanotter4 Newcomer
4 messages
joined Aug 2007
#15 ·
Gary Turner96 said:EDIT :

program This_does_nuthin;

uses
Crt;

begin
{ Be sure to type this the same way you see it. }
Writeln('Wabba, wabba!');
end.
here's the code .. I copied it exactly like this and it won't work .. tried it without those brackets near "be sure to ..." still nothing ... I've tried everything but when I hit RUN (ALT + F5) it just fails .. and keeps failing .. all I get is a BLANK SCREEN ...

Just saw this code. What exactly did you expect it to do? It’s a program designed to spit out Wabba, Wabba on the screen. What were you thinking?

The reason it might not "work" for you is probably because the program runs and then immediately closes the window. If you actually want to see the output—to have the screen stay open showing that Wabba, Wabba—add the readkey command before the last line. That way, the program waits for you to press any key before moving on.
Gary Turner96 Gary Turner96 MemberOP
17 messages
joined Dec 2012
#16 ·
The issue is... it won't even print out Wabba wabaaa... no clue why—it worked once after I hit file > Save as, but then I opened it the next day and nothing! It's just dead... I wrote the code, hit Alt + F9, everything looks fine, but absolutely nothing happens...
Gary Turner96 Gary Turner96 MemberOP
17 messages
joined Dec 2012
#17 ·
I know it's a massive ask—but any chance we can get this wrapped up by 7:00 PM tonight? 🙏
I know it's a huge ask—but any chance we can get this wrapped up by 7:00 PM tonight?

Yo, just drop those assignments here—and I'll get you a link to download Pascal that actually works...!

Task 1.
Just grab like three numbers, open 'em up, and boom—print them out in order from smallest to largest!

Task 2.
Load up the sum and product of two natural numbers—then figure out which ones they actually are!

Task 3.
Solving a system of two linear equations with two variables—easy peasy!

Task 4.
May 17, 1977—the clock just totally quit on us at 9:13 AM!
Figure out how many times the second hand didn't move up until November 14, 2007, at 9:13 AM!

Task 5.
Load up like 3 triangles and 3 rectangles—then just crunch the perimeter and area for each to see how they stack up! Sort 'em from smallest to largest (and vice versa!), grab those min and max values, and then check if they're even or odd. Finally, split those evens and odds into their own little lists!

Task 6.
Just pop in the heights and weights for like three students—simple enough! Then figure out who’s the absolute unit (tallest and heaviest) versus who's the smallest (shortest and lightest). After that, just group them by height ranges—like 150-170, 171-190, or 191-200—and weight brackets like 50-70, 71-90, and so on. Finally, see which student hits that specific 156 height and 55 weight combo!
Just toss them in order from shortest to tallest and lightest to heaviest at the end!

Task 7.
Three students are hitting up this biology, math, and physics competition—max score is 150 total (50 per subject), with 0 being the floor. Gotta rank them individually and by subject, then figure out who's the GOAT and who totally flopped. Also, gotta spot anyone hitting that 100 or 150 mark and check if everyone actually showed up to take the test!

I know it's a ton to ask—but any chance we can get this wrapped up by 7:00 PM tonight? 🙏
I know it's a massive ask—but any chance this could be wrapped up by 7:00 PM tonight?
Gary Turner96 Gary Turner96 MemberOP
17 messages
joined Dec 2012
#18 ·
AHHHH TOO LATE—but hey, you guys can still crush those assignments... I might just hook her up if she pops onto AIM... hopefully before midnight! 🙂
urbanotter4 urbanotter4 Newcomer
4 messages
joined Aug 2007
#19 ·
Here's the first one, if I read you right. I "spiced it up" a little and cleaned it up, so feel free to cut whatever you want. Oh, and since there was no mention of what kind of numbers we're dealing with, I just used integers. Doesn't really matter though; in a problem like this, it’s not about the data type, it’s about whether the student actually knows how to write a sorting algorithm. 🤷

Code:
program Compare;
uses crt;
type line=array [1..3] of integer;
var a:line;
i,j,t,min:integer;
begin
clrscr;
for i:=1 to 3 do begin
writeln('Enter number ',i);
read(a);
end;
writeln('The array entered is:');
for i:=1 to 3 do write(a:5);
writeln;
for i:=1 to 3 do begin
min:=i;
for j:=i+1 to 3 do
if a[j]<a[min] then min:=j;
t:=a;
a:=a[min];
a[min]:=t;
end;
writeln;
writeln('Ascending:');
for i:=1 to 3 do write(a:5);
writeln;
writeln('Descending:');
for i:=3 downto 1 do write(a:5);
readkey;
end.
Gary Turner96 Gary Turner96 MemberOP
17 messages
joined Dec 2012
#20 ·
Hey, if you guys could just knock out the rest of these assignments for me—I'm not even sweating the deadline, just really need them done right!

You must log in or register to reply here.

Log in Register

🔗 Similar threads