Qbasicnews.com
November 28, 2021, 12:19:04 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Print'a'Box using Astrix  (Read 3219 times)
n00b_e
New Member

Posts: 19


« on: May 08, 2003, 11:06:25 PM »

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

Cheesy
Logged
wizardlife
Na_th_an
*****
Posts: 1456


WWW
« Reply #1 on: May 08, 2003, 11:09:12 PM »

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?
Logged

n00b_e
New Member

Posts: 19


Yes
« Reply #2 on: May 08, 2003, 11:14:56 PM »

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.
Logged
Agamemnus
x/ \z
*****
Posts: 3491



« Reply #3 on: May 08, 2003, 11:17:20 PM »

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?
Logged

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.
wizardlife
Na_th_an
*****
Posts: 1456


WWW
« Reply #4 on: May 08, 2003, 11:40:18 PM »

Quote from: "Agamemnus"
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.
Logged

Agamemnus
x/ \z
*****
Posts: 3491



« Reply #5 on: May 08, 2003, 11:45:22 PM »

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

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.
wizardlife
Na_th_an
*****
Posts: 1456


WWW
« Reply #6 on: May 09, 2003, 12:23:26 AM »

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


Yes, yes you did.
Logged

Glenn
I hold this place together
*****
Posts: 786



WWW
« Reply #7 on: May 09, 2003, 12:53:09 AM »

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

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.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!