English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

In one of my classes I have to use a program called "Just basic" and i have to find a way to make the program pick a random integer from 1-10 (I figured out that part) but i dont know how to get the program to write a sentence like Happy birthday that many random times. Is anyone familiar with the program?
The beginning of the program i know is:

num= int(rnd(1)*10)+1
Print num
Print "Happy Birthday";

.... and thats where i get lost.

2006-10-06 17:56:19 · 3 answers · asked by Im HoT Ur NoT 1 in Computers & Internet Programming & Design

3 answers

num= int(rnd(1)*10)+1
for x=1 to num
print num
Print "Happy Birthday"
next x

2006-10-07 02:31:49 · answer #1 · answered by lampoilman 5 · 0 0

Your question doesn't really make sense. "I don't know how to get the program to write a sentence like Happy birthday that many random times"

If you're trying to make it randomly appear you can set it up as a variable like you do with random numbers. Just give the number chosen something like Input $a. Then you can do a command like If Input $a = 5 then print "happy birthday". If the program doesn't accept "then" you could use a goto command to have it go to the command line that prints happy birthday.

Good lord it's been a long time since I used BASIC.

2006-10-06 18:07:55 · answer #2 · answered by taskr36 4 · 0 0

Peek in your book and look up the FOR .. NEXT loop statements and (hint) use a counter variable in your FOR that counts up to NUM and wrap your Happy Birthday in the FOR and the NEXT

2006-10-06 18:01:13 · answer #3 · answered by holden 4 · 0 0

fedest.com, questions and answers