You are invited to Log in or Register a free Frihost Account!

# QBasic

eldarc
I will learn te Qbasic Lanague. Can You me help

PS: sory for the bad English.
S3nd K3ys
 eldarc wrote: I will learn te Qbasic Lanague. Can You me help PS: sory for the bad English.
eldar
I maked a QBasic program:
This is a game.

CLS
RANDOMIZE TIMER

INPUT "Sirina? ", UkupX
INPUT "Duzina? ", UkupY
PRINT
PRINT

TrenX = 1 'Trenutni polozaj
TrenY = 1

Korak = 0 'Broj koraka
Pet = 0 'Ovoliko puta je pritusnuta petica.

SvjX = INT(RND * UkupX) + 1
SvjX = INT(RND * UkupY) + 1

SvjX = 3
SvjY = 4

DO
INPUT "Kuda? ", a

SELECT CASE a

CASE 4 '----------------------------------------Lijevo
IF TrenX = 1 THEN
PRINT "Nemos kroz zidove!!!"
PRINT
GOTO 10
ELSE
TrenX = TrenX - 1
Korak = Korak + 1
PRINT "Sad si na ("; TrenX; ", "; TrenY; ")."
PRINT
END IF

CASE 6 '----------------------------------------Desno
IF TrenX = UkupX THEN
PRINT "Nemos kroz zidove!!!"
PRINT
GOTO 10
ELSE
TrenX = TrenX + 1
Korak = Korak + 1
PRINT "Sad si na ("; TrenX; ", "; TrenY; "). "
PRINT
END IF

CASE 8 '---------------------------------------Gore
IF TrenY = kupY THEN
PRINT "Nemos kroz zidove!!!"
PRINT
GOTO 10
ELSE
TrenY = TrenY + 1
Korak = Korak + 1
PRINT "Sad si na ("; TrenX; ","; TrenY; "). "
PRINT
END IF

CASE 2 '---------------------------------------Dolje
IF Tren >= 1 THEN
PRINT "Nemos kroz zidove!!!"
PRINT
GOTO 10
ELSE
TrenY = TrenY - 1
Korak = Korak + 1
PRINT "Sad si na ("; TrenX; ","; TrenY; ")."
PRINT
END IF

CASE 5 '---------------------------------------Gdje je?
Pet = Pet + 1

PRINT "Svjetiljka je ";
IF TrenX > SvjX THEN
PRINT "lijevo ";
ELSEIF TrenX < SvjX THEN
PRINT "desno ";
END IF

IF TrenY > SvjY THEN
PRINT "dolje";
ELSEIF TrenY < SvjY THEN
PRINT "gore";
END IF

PRINT "."
PRINT

CASE ELSE
PRINT "4- lijevo, 6- desno, 8- gore, 2- dolje, 5- polozaj svjetiljke"

END SELECT

10
LOOP UNTIL TrenX = SvjX AND TrenY = SvjY

PRINT
PRINT "Nasao si svjetiljku u"; Korak; "koraka!"; Pet; "puta si stisnuo 5."
eldar
I maked a program:

10 CLS : CLEAR
20 PRINT "pogaÐanje broja od 1 - 1000 "
30 PRINT " ============================"
40 RANDOMIZE TIMER
50 c = INT(RND * 100)
60 PRINT " pokuçaj "; POK
70 INPUT " unesi broj 1-100 - > ", br
80 CLS
90 IF c > br THEN PRINT " promaçaj! Broj je ve†i ! "
100 IF c < br THEN PRINT " Promaçaj ! Broj je manji!"
110 IF c = br THEN PRINT " Pogodak! cestitam pogodili ste! ": SOUND 900, 20: GOTO 140
120 PRINT POK = POK + 1
130 GOTO 60
140 INPUT " PONOVO?", DN\$
150 IF DN\$ = "N" OR DN\$ = " N" THEN STOP
160 GOTO 10
Grimboy
Ahh... QBASIC, many days of spagetti code, cryptic commands, all caps and usually a lack of indentation.