Posts: 19
Threads: 7
Joined: May 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
Posts: 720
Threads: 46
Joined: Oct 2001
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?
Posts: 19
Threads: 7
Joined: May 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.
Posts: 3,368
Threads: 195
Joined: Jan 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?
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.
Posts: 720
Threads: 46
Joined: Oct 2001
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.
Posts: 3,368
Threads: 195
Joined: Jan 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).
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.
Posts: 720
Threads: 46
Joined: Oct 2001
Quote:Well I really ruined this guy's future career in CS by giving him the answer, didn't I?
Yes, yes you did.
Posts: 704
Threads: 0
Joined: Dec 2002
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.