Make Me Example Pls

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Post Reply
ungaz
Newbie
Posts: 3
Joined: Mon Aug 23, 2010 8:51 am

Make Me Example Pls

Post by ungaz »

Calculator Type

Enter Total Number to Manipulate ? 3
Enter The 1st No. ? 2
Enter The Operation (+ - / * )? +
Enter The 2nd No. ? 3
Enter The Operation (+ - / * )? -
Enter The 3rd No? 1
The Result if 2+3 - 1 is :4

EDIT :))
Last edited by ungaz on Tue Aug 24, 2010 4:31 am, edited 1 time in total.
User avatar
GarryRicketson
Veteran
Posts: 90
Joined: Fri Jul 16, 2010 10:02 am
Location: Cuencame,Durango,Mexico
Contact:

make me an example

Post by GarryRicketson »

I was not sure I usderstand the question, did you need an example of
a calculater? I don't know much, but I don't think the text you show above
would work....I wish it was that simple... I got this out of the QB64 program,
in the QB64/samples/pete/cal.bas and hope he dose not mind , I don't
thinks so as I guess thats why he put in the samples...but to give credit
where it is due... In various posts here is links to the QB64 site if you do
not have it....here is the example,
_____code below______

5 CLS
PRINT "1) ADD"
PRINT "2) MULTIPLY"
PRINT "3) DIVIDE"
PRINT "4) SQUARE ROOT"
PRINT "5) EXIT"
INPUT I
IF I = 1 GOTO 10
IF I = 2 GOTO 20
IF I = 3 GOTO 30
IF I = 4 GOTO 40
IF I = 5 GOTO 50
END
10 CLS : PRINT "INPUT NUMBER"
INPUT A
CLS
PRINT "INPUT NEXT NUMBER"
INPUT B
CLS
PRINT A + B
PRINT "PRESS SPACE TO RUN"
SLEEP 0
GOTO 5
20 CLS : PRINT "INPUT NUMBER"
INPUT C
CLS
PRINT "INPUT NEXT NUMBER"
INPUT D
CLS
PRINT C * D
PRINT "PRESS SPACE TO RUN"
SLEEP 0
GOTO 5
30 CLS : PRINT "INPUT NUMBER"
INPUT E
CLS
PRINT "INPUT NEXT NUMBER"
INPUT F
CLS
PRINT E / F
PRINT "PRESS SPACE TO RUN"
SLEEP 0
GOTO 5
40 CLS : PRINT "INPUT NUMBER"
INPUT G
CLS
PRINT SQR(G)
PRINT "PRESS SPACE TO RUN"
SLEEP 0
GOTO 5
50 END
_______end code_______
Hope this helps, I got alot of help here when I first started, so hope fully
I can also help.
from Garry
http://www.garryspages.webs.com
ungaz
Newbie
Posts: 3
Joined: Mon Aug 23, 2010 8:51 am

Post by ungaz »

ill try to do it but it say "label not defined" thanks for helping me such a relief :)
User avatar
GarryRicketson
Veteran
Posts: 90
Joined: Fri Jul 16, 2010 10:02 am
Location: Cuencame,Durango,Mexico
Contact:

give me example

Post by GarryRicketson »

Ok, well I double checked it,
on my computer, and qb64 it works, Are you sure you copied it correctly,
if it says label not defined, it sounds like one of the numbers in the goto state
ment, or letter is missing or not right, Below is another ,but just, for multi-
plication, and it is in spanish, but easy to usnderstand "primero" is first,
"segundo" second.
--------code below......

INPUT "Entra el primero numero: ", a
INPUT "Entra el segundo numero: ", B
PRINT "la respuesta correcto es: "; a * B
---------end code------------------
if you write the same code but change the * to +,or -, or /
and then you would need to do like the other, have 4 choices,
one for add, 2 subtract, etc.....
I suggest getting the tutorials that are available, the one for kids
by Ted Felix covers this, also bootcamp, is good,...got to run now as
I am going to be late for work
from Garry
http://www.garryspages.webs.com
ungaz
Newbie
Posts: 3
Joined: Mon Aug 23, 2010 8:51 am

Re: give me example

Post by ungaz »

GarryRicketson wrote:Ok, well I double checked it,
on my computer, and qb64 it works, Are you sure you copied it correctly,
if it says label not defined, it sounds like one of the numbers in the goto state
ment, or letter is missing or not right, Below is another ,but just, for multi-
plication, and it is in spanish, but easy to usnderstand "primero" is first,
"segundo" second.
--------code below......

INPUT "Entra el primero numero: ", a
INPUT "Entra el segundo numero: ", B
PRINT "la respuesta correcto es: "; a * B
---------end code------------------
if you write the same code but change the * to +,or -, or /
and then you would need to do like the other, have 4 choices,
one for add, 2 subtract, etc.....
I suggest getting the tutorials that are available, the one for kids
by Ted Felix covers this, also bootcamp, is good,...got to run now as
I am going to be late for work
from Garry
http://www.garryspages.webs.com
ITS WORKING NOW....THANKS DUDE YOU SAVE MY GRADE THANKS A LOT
User avatar
GarryRicketson
Veteran
Posts: 90
Joined: Fri Jul 16, 2010 10:02 am
Location: Cuencame,Durango,Mexico
Contact:

please give me a example,

Post by GarryRicketson »

Well thats good,
But don't thank me, Thank the guys that made the code avail bel,
all I did is cut and pasted it, in my reply, any way glad to here it
worked out, I hope you check out the tutorials, I mentioned,....and
then here is always a good place to ask if yu don't completely understand
something,....I really know very little, but this one on the math and
calculater, I got started,because I wanted to make a times table exercise
for my son, to help him with his X tables , I am trying to learn enough
to maybe do some games and graphic stuff, but got a long ways to go...
glad I could be of help,but the real thanks goes to this site and the QB64,
site,...Also the QB45...which is what I started with, well before I had played
around with QBasic, in Dos , but then I needed something more to make
executables, so I started searching, I found this site, from a answer to
a question about makeing executalbesl,that I posted on the Yahoo, question
and answer thing...ok well this is to long so bye
From Garry
http://www.garryspages.webs.com
Post Reply