Sinisterly
BASIC basic tutorial - Printable Version

+- Sinisterly (https://sinister.ly)
+-- Forum: Hacking (https://sinister.ly/Forum-Hacking)
+--- Forum: Tutorials (https://sinister.ly/Forum-Tutorials)
+--- Thread: BASIC basic tutorial (/Thread-BASIC-basic-tutorial)



BASIC basic tutorial - HeR97 - 02-11-2012

BASIC is a family of general-purpose, high-level programming languages whose design philosophy emphasizes ease of use - the name is an acronym from Beginner's All-purpose Symbolic Instruction Code.
To program with BASIC you'll need to download QBasic

Basic elements of BASIC
BASIC "is made" from following elements

1.
Big letters of English alphabet: A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z
2.
"Decimal digits"
0,1,2,3,4,5,6,7,8,9
3.
Special symbols
. , ; # $ % & "
4.Symbols of arithmetic operations
+ - * / ^
5.Relation symbols
< > <= >= <> >< =
6.Symbols that make up the word in English
INPUT LET END FOR NEXT PRINT etc

Lets make a simple calculator
Begin with CLS (clear screen)

Code:
CLS INPUT "Input numbers";A,B C = A * B D = A - B E = A / B F = A + B PRINT "Results are";C,D,E,F END
As you can see our code calculates the variables
With PRINT command we printed the results

Now we'll make program with condition

Code:
CLS INPUT "Input numbers"A,B IF A = 0 THEN PRINT "Impossible to divide with zero" ELSE PRINT "Result is";A/B END IF END
You can see that if a = 0 then our program will print Impossible to divide with zero
And if it isn't it will print the result

Lets list numbers from 1 to N (number we choose)
Code:
CLS INPUT "Input ending number";N FOR I = 1 TO N PRINT I NEXT I END

Lets make a program for squaring
Code:
CLS INPUT "Input number";X A = X ^ 2 PRINT "Result is";A END
A = X ^ 2 is squaring the number
I think these are basics
Can help to someone who wants to learn and for someone who is doing maths homework


RE: BASIC basic tutorial - 4don4i - 02-16-2012

good tut.....thanks for the share.