Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Print'a'Box using Astrix
#1
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
Reply
#2
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?
Reply
#3
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.
Reply
#4
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?
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Reply
#5
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.
Reply
#6
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).
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Reply
#7
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]
Reply
#8
for however important that point is. It's called a "column matrix" or "row matrix" (also called a "vector").
ravelling Curmudgeon
(geocities sites require copying and pasting URLs.)
I liked spam better when it was something that came in a can.
Windows should be defenestrated.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)