Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Help with QBasic..

I just got into programming with QBasic and I need too know some things...



First, how do I make it so, like for instance, if someone entered a 1 in an input it would play a sound, if they entered a 2 it would be different, etc.



Next, how do I randomize numbers, so it would just be 2 digits and it would display it on the screen?



And finally, how do I clear the screen at the beginning of a QBasic program???



Thanks,



C0ZMIKX






URL:http://members.tripod.com/cozmikx/main.htm

Comments

  • : First, how do I make it so, like for instance, if someone entered a 1 in an input it would play a sound, if they entered a 2 it would be different, etc.

    :

    Take a look at the command "Sound". It takes a frequency and duration as parameters.



    Input "Enter a number between 37 and 32767: ";Freq

    Input "Enter a number between 0 and 65535: ",Dur

    Sound Freq, Dur



    : Next, how do I randomize numbers, so it would just be 2 digits and it would display it on the screen?

    :

    Use randomize to "reseed" the random number generator. Then use the formula "INT ((upperbound - lowerbound + 1)*RND + lowerbound)" where upperbound and lowerbound are the highest and lowest possible numbers you want to have returned.



    RANDOMIZE TIMER

    Print INT ((90) * RND + 10)



    : And finally, how do I clear the screen at the beginning of a QBasic program???

    :

    CLS



    Hope this helps!


Sign In or Register to comment.