Copy Link
Add to Bookmark
Report

SK-PROGI

eZine's profile picture
Published in 
Koma
 · 4 years ago

  


Introduction to programming

Written by : SlAk for the June 1996 koma release.
Written in : Toronto, Canada.

Many people have no clue about programming, in this text file you will
hopefully learn the basics and also learn a bit of turing [ an intermediate
programming language ] We will zip through several key aspects of turing
programming to help you understand programming a little better. But first
something that may explain a few things.. you dont NEED to know the binary
one.. but its good to under stand it.

Q> What is a source code?
A> A source code is the actual program itself when you view an .exe
or a com file you are not seeing the source code, you are seeing
it AFTER it has been compiled [ changed from the programming
language to a language that your computer will understand.]

Q> Why are programmers soo snitchy with their source codes?
A> If you get the source code for say windows 95 you can change
ABSOLUTELY EVERYTHING AND ANYTHING in it.. then you can sell
if for half the price they sell it for. Its similar to the
way car companies guard the blueprints and plans to their
cars, and food companies guard their recipies. They dont want
you to get your grubbly little paws on them.

Q> Explain binary.
A> Binary is also called machine code. It is a series of ones and
zeros that [ 1 = on, 0 = off ] it is a base 2 number system.
Hexidecimal is a base 16 number system. This is pretty complicated
and difficult to explain. Lets say i wanted to convert a regular
number into binary any number hmm... lets say 56 ( decimal ) you
have to do this,
32
128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | 16
------------------------------------ 8 +
0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | ---
56
binary = 00111000

hopefully that has thrown a bit of light on it. =)


TURING Starting Out, Simple commands
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

( you really have to follow this, cause i didnt format it too well)
Batch files are a very basic form of programming. Real programming
gives you much more power and many more options. DO NOT USE CAPItALS
for commands [ you can for variables ] because if you do they wont
work.

nothing will display unless you tell it to, you can by doing this,
[ to run your program press F1 ]

put "look i am programming"

Run your progam and this will be the output you'll see,

look i am programming

The put command displays everything in the quotes.

Variables: to declare a variable [ text ] you would type,

var whatever : string

The 'whatever' can be anything you want you can also use capitals
In your variable. To declare a variable that is a number [ integer ]
You,

var whatever : int

For a real number its,

var whatever : real

If you want to ask the user a question you use variables and a new
command 'get' so,
%*******************************************************************************
%the nAme And Age progrAm
var Name : string
var Age : real

put "Enter your name :"..
get Name
put "Enter your age :"..
get Age

put "Your name is ", Name, "and you are ", Age, " years old."

from the blank line above to the line of stars is your source code.
the two dots after the questions are called elipsis [ .. ] that tells
the 'get' command to get from the same line, try removing them to
see what happens. What the %blah blah means,

Lets say you want to make a note on your program all you have to do
is put a % sign before you type and it will not display the error
message and will also not display it on the output.

You can do math look,

var a, b, c, total : int
g := 5

put "enter a number:"..
get a
put "enter another one:"..
get b
% the first two will be added and then multiplied by g
c = a + b
total = c * g
put " the total is ", total, "

see pretty easy, what i did with the g := 5 is, i told the program
that g would equal five if i changed it to 6 it would multiply
the total of 'a' and 'b' by 6 instead of 5. its Declaring the
variable instead of asking the user to.

loops:
lets say you want your program to continue forever or a selected
number or times, you need to make a loop, here is an example,

loop
put "hello"
end loop

that will output 'hello' over and over again when you run it.
here is a loop that will loop only 5 times it is called a
counted loop,

%the "averages" program
%reads marks and computes average
var mark : int
var sum :int :=0
put "Enter marks: "..
for count : 1 .. 5
put count
get mark
sum := sum + mark
end for

thats more complicated than the others we have used, but
you should be able to figure it out.

Sound and Colour :
this is pretty easy to do but makes your program a lot
more fun than boring old grey and silence.. too bad you
can only use beeps though =(

colour(4)
put " dark red "
colourback (2)
put " wow the background is green! "

there is basically how you do colour. now for music,
you can play notes or pitches [ htz i think ] heres how.

play ("D")
play ("F+)

that plays the note D and an F sharp. Theese notes are played as
quarter notes. The duration of a note is given by a single number
according to this table,

1 whole note
2 half note
4 quarter note
8 eighth note
6 sixteenth note

so this plays C as an eigth note,

play (8C")

the other way i believe goes something like this

music (200, 200)

the 200, 200 can be anything each a different pitch.


I will also include a few source codes with this turing program
and compiler, I have not covered file editing or pixel graphics
or a number of other things, so dont think you know all there
is to know..about turing =) To compile your program type,

tcomp programename.t programeameoutput.exe

You'll now have an exe.. to change asciis to exe you have to put the

put " ,d$$$b, "

for everysingle line. And then compile it =( hope fully you have
figured out the cut and paste command..hehheh..

Turing programs save with a .T extension here is a list of
what of what other programming languages save their sources
as so you can keep an eye out for them,

Pascal / turbo pascal : *.PAS
Borland C / C++ : *.C
Basic / Qbasic : *.BAS
Assembly : *.ASS ?

These are totally different languages and though the programming
structures are similar, the commands [ syntax ] is totally different
they are also far more powerful than turing. Most things are made
in Pascal or C++ . The old stuff like DBASE, COBOL, FORTRAN and
even BASIC is totally outdated.

To get a turing book that teaches you EVERYTHING about turing write to,

Holt Software Associates Inc
203 Collage Street., Suite 305,
Toronto, Canada
M5T 1P9

and ask for a book called " TURING : a better approach to computer
programming." this book will help you more than i could. But i would
reccommend that if you want to be a programmer don't further your studies
in turing but learn about C ++ or Pascal.


I hope you have enjoyed this text file, if there are any questions,
comments, additions, flames or tips do not hesitate to call any
koma board on the member list. Or you can reach me a lot quicker
on my board,
acidic tear (905)201-0739

To all those lame groups who cannot stop trying to be 'hackerz'
write your own texts and PLEASE make them original. IF they are
not, then what good are you doing anybody? Even if no one ever
finds out and people all think you are 33l1t3 you still wont
be, you will stay a LAME for ever.

slak - koma june 1996 - toronto canada
SAUCE00introduction to programming SlAk koma P

← previous
loading
sending ...
New to Neperos ? Sign Up for free
download Neperos App from Google Play
install Neperos as PWA

Let's discover also

Recent Articles

Recent Comments

Neperos cookies
This website uses cookies to store your preferences and improve the service. Cookies authorization will allow me and / or my partners to process personal data such as browsing behaviour.

By pressing OK you agree to the Terms of Service and acknowledge the Privacy Policy

By pressing REJECT you will be able to continue to use Neperos (like read articles or write comments) but some important cookies will not be set. This may affect certain features and functions of the platform.
OK
REJECT