Qbasicnews.com

Full Version: Print'a'Box using Astrix
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello all. I am wondering how to make a program that asks the user for 2 inputs, then on the screen, prints out input1 * input2 as a rectangle usingastrix's......i am stuck on which loop to use, and how to use it....
Thanx in advance

Big Grin
So have you attempted this computer science assignment yourself yet? Can you input the numbers? Do you know how to use the STRING$ command? Can you use a FOR loop? Has your teacher discussed it in class at all?
Yes, i have attempted it, but i got stuck at what to do after the for...next loop....even still.....how to use the for...next loop in this problem....no, the string command i don't know, and he didn't teach it.
THere IS NO STRING$ COMMAND! It's STR$! Anyways,

There is no way that it is possible for one to get a matrix from two numbers.

Do you mean you want, say, 6 and 7, and then 1 through 6 * 1 through 7?
Quote:THere IS NO STRING$ COMMAND! It's STR$! Anyways,

There is no way that it is possible for one to get a matrix from two numbers.

Do you mean you want, say, 6 and 7, and then 1 through 6 * 1 through 7?

Yes there is a STRING$ command. Look it up: http://www.qbasicnews.com/qboho/qckstring$.shtml

All he needs to do is make a box out of stars that has a height and widths inputtable from the user.
oh...yeah..... that one. oh... oh..... ok..... i'll just slap myself on the head.

Code:
INPUT "What width and height do you want? ", A%, B%
FOR I% = 1 to A%
FOR J% = 1 to B%
PRINT "*"; 'If you don't have the ;, QBASIC will automatically add a carriage return (skip to the next line)
NEXT J%
PRINT
NEXT I%

or with string$ um I guess:

Code:
INPUT "What width and height do you want? ", A%, B%
FOR I% = 1 to A%
PRINT STRING$(B%, "*")
NEXT I%


Well I really ruined this guy's future career in CS by giving him the answer, didn't I?

EDIT: made length width and added a chr$(32).
Quote:Well I really ruined this guy's future career in CS by giving him the answer, didn't I?

Yes, yes you did. [Image: bangin.gif]
for however important that point is. It's called a "column matrix" or "row matrix" (also called a "vector").