Qbasicnews.com
April 06, 2020, 11:48:34 AM *
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: displaying the position number of the for loop  (Read 2315 times)
Techno
Senior Member
**
Posts: 228


WWW
« on: March 13, 2003, 05:26:18 PM »

how do I display the pos number of the for loop? for example:

Code:

input "Enter amount of values to enter: ",c

for x = 1 to c
   input "Enter value number: " + x
next x



the + x obviously won't work, but how do I tell it to enter value x, the position the for loop is on?

thanks Smiley
Logged
ak00ma
Ancient Guru
****
Posts: 669



« Reply #1 on: March 13, 2003, 05:31:49 PM »

Quote from: "Techno"

Code:

input "Enter amount of values to enter: ",c

for x = 1 to c
   input "Enter value number: " + x
next x




Try this:
(EDIT)
Code:

input "Enter amount of values to enter: ",c

for x=1 to c
 Print "Enter value number"+str$(x)  
 input ,var
next x
Logged

B 4 EVER
Techno
Senior Member
**
Posts: 228


WWW
« Reply #2 on: March 13, 2003, 05:37:42 PM »

thanks for the quick reply Smiley unfortunatly, didn't work, the editor is saying it expect a ; or ,
Logged
na_th_an
*/-\*
*****
Posts: 8244



WWW
« Reply #3 on: March 13, 2003, 06:30:54 PM »

First of all, you'll need an array to store things...

Code:
INPUT "Number of elements"; a%
DIM var%(a%)
FOR i% = 1 TO a%
   PRINT "Enter Úlement no. " + STR$(i%);
   INPUT var%(a%)
NEXT i%
Logged

SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Glenn
I hold this place together
*****
Posts: 786



WWW
« Reply #4 on: March 13, 2003, 09:09:09 PM »

where you INPUT var.  (You shouldn't need it since there isn't a prompt string.)



Quote from: "Techno"
thanks for the quick reply Smiley unfortunatly, didn't work, the editor is saying it expect a ; or ,
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.
Glenn
I hold this place together
*****
Posts: 786



WWW
« Reply #5 on: March 13, 2003, 09:10:17 PM »

only to arrays.

Quote from: "na_th_an"
First of all, you'll need an array to store things...

Code:
INPUT "Number of elements"; a%
DIM var%(a%)
FOR i% = 1 TO a%
   PRINT "Enter Úlement no. " + STR$(i%);
   INPUT var%(a%)
NEXT i%
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.
na_th_an
*/-\*
*****
Posts: 8244



WWW
« Reply #6 on: March 14, 2003, 12:13:35 AM »

Do you always have something to point out? I am fearing to reply a message right now 'cause maybe my post is not perfect!
Logged

SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Hexadecimal Disaster
Been there, done that
*****
Posts: 1123



« Reply #7 on: March 14, 2003, 12:41:57 AM »

Sir, "Travelling Curmudgeon" isn't just his signature. It's his lifestyle.
Logged

img]http://usuarios.vtr.net/~disaster/sigs/annoyizer.php[/img]
Glenn
I hold this place together
*****
Posts: 786



WWW
« Reply #8 on: March 14, 2003, 01:04:59 AM »

It's not my fault there's so much misinformation in the world.  Smiley  I'm only one guy.  (It's a dirty job, but someone has to do it.)

However, if you're going to misidentify what the problem is that someone's having and cause people to think they *have* to obey some rule that doesn't exist, well..., yeah..., I'm going to be an obstacle.  Smiley


Quote from: "na_th_an"
Do you always have something to point out? I am fearing to reply a message right now 'cause maybe my post is not perfect!
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!