Jump to content



Photo
- - - - -

Display the index of a FOR-NEXT loop?


  • Please log in to reply
1 reply to this topic

#1 cnelsonw

cnelsonw

    Newbie

  • Members
  • Pip
  • 2 posts

  • Calculators:
    fx-9860GII

Posted 02 May 2017 - 03:21 PM

I have written a program to apportion seats using Hamilton's Method of Apportionment.  In the program I store data in lists using a FOR-NEXT loop, using the index of the loop to place each population into the list.

   For 1-> A to C

    "STATE POP"?->List 1[A]

   Next

 

I would like the display to ask:  STATE 1 POP?

The 1 would come from the loop index.  Is there a way to include the loop index in the display?

 

Thanks for any help.



#2 sentaro21

sentaro21

    Casio Technician

  • Members
  • PipPipPipPipPipPip
  • 369 posts
  • Gender:Male
  • Location:JAPAN

  • Calculators:
    FX-603P fx-4800P fx-5800P
    CFX-9850GC PLUS
    fx-9860G
    fx-9860GII
    fx-9860GII-2
    fx-9860GII-2 SD
    fx-CG10
    fx-CG20
    fx-CG50
    HP-Prime
    HP 50G
    TI-Nspire CX CAS
    TI-84+CE

Posted 03 May 2017 - 04:15 AM

Hi,
 
Because there is not the command to convert number into character string instantly,
If variable C is less than 9,
it is possible by using the StrMid() command. :)
   For 1-> A to C
    "STATE "+StrMid("123456789",A,1)+" POP"?->List 1[A]
   Next
 
If variable C is less than 20,
   For 1-> A to C
    "STATE "+StrMid(" 1 2 3 4 5 6 7 8 91011121314151617181920",A,2)+" POP"?->List 1[A]
   Next





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users