Qbasicnews.com
Print'a'Box using Astrix - Printable Version

+- Qbasicnews.com (http://qbasicnews.com/newforum)
+-- Forum: QBasic (http://qbasicnews.com/newforum/forum-4.html)
+--- Forum: QB Discussion & Programming Help (http://qbasicnews.com/newforum/forum-11.html)
+--- Thread: Print'a'Box using Astrix (/thread-800.html)



Print'a'Box using Astrix - n00b_e - 05-09-2003

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


Print'a'Box using Astrix - wizardlife - 05-09-2003

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 - n00b_e - 05-09-2003

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.


don't confuse the poor boy. - Agamemnus - 05-09-2003

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?


Re: don't confuse the poor boy. - wizardlife - 05-09-2003

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.


Print'a'Box using Astrix - Agamemnus - 05-09-2003

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).


Print'a'Box using Astrix - wizardlife - 05-09-2003

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]


And of course you can make a matrix with 2 numbers... - Glenn - 05-09-2003

for however important that point is. It's called a "column matrix" or "row matrix" (also called a "vector").