how to convert Basic table to C ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Jim Rockett
    New Member
    • Aug 2010
    • 7

    #1

    how to convert Basic table to C ?

    I am converting a Basic program to C here is a problem I have

    Below is a table writen in Basic. Besides removing the line numbers how do you convert it to C The table was defined in Basic along with others this way.
    What needs to be done here for C?

    97 DIM A(25),B(25),C(2 5),T(25),V(25)

    100 DIM TABLEA (10,10)
    110 DIM TABLEB (10,10)
    120 DIM TABLEC (10,10)
    130 DIM TABLED (10,10)
    140 DIM TABLEE (10,10)
    150 DIM TABLEF (10,10)
    160 DIM TABLEG (10,10)
    170 DIM TABLEH (10,10)
    180 DIM TABLEI (10,10)

    Here is table.

    1080 IF (CurveRILM/CurveRILD<1) THEN CurveRILM/CurveRILD=1
    1090 IF (CurveRILM/CurveRILD>1.9) THEN CurveRILM/CurveRILD =1.9
    1100 TABLEA (0,1)=1,0
    1110 TABLEA (0,2)=1.05
    1125 TABLEA (0,3)=1.1
    1130 TABLEA (0,4)=1.2
    1135 TABLEA (0,5)=1.3
    1140 TABLEA (0,6)=1.4
  • donbock
    Recognized Expert Top Contributor
    • Mar 2008
    • 2427

    #2
    Let's pretend for a moment that I don't know anything about Basic. Please explain to me what the following lines do:
    Code:
    100 DIM TABLEA (10,10)
    ...
    1100 TABLEA (0,1)=1,0

    Comment

    • Jim Rockett
      New Member
      • Aug 2010
      • 7

      #3
      Line 100 gives the dimensions of a table as being 10x 10 10 across and 10 down.
      Line 1100 Gives the location of the number in ()the table
      in this case 0 means on the top row left side first digest the number after the = is the value of the first number..The table can also be written as (0,1)=1,0, (0,2)= 1.05, (0,3)=1.1, and so on

      Comment

      • donbock
        Recognized Expert Top Contributor
        • Mar 2008
        • 2427

        #4
        To put it another way, the first line defines an array variable and the second assigns a value to an element in that array variable.
        1. How do you define an array variable in C?
        2. How do you assign a value to an array element in C?

        Comment

        Working...