2d Array or record? - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

2d Array or record?

Perand1414Perand1414 Posts: 2Member
I'm making a program to update our prices and discount.
Reading a file, layout : G30;48
which means discount code is G30 which in turn equal 48%
I can read it but need a simple example on how to implement it.

I read a line in the pricefile, this line contains different info, like number, text and discount code, so I have to determine the discount everytime I read a line, but would like to make the work as little as possible, since I have to read around 108.000 lines and work on them, any suggestions?

regards
John

Comments

  • DWDuckDWDuck Posts: 31Member
    : I'm making a program to update our prices and discount.
    : Reading a file, layout : G30;48
    : which means discount code is G30 which in turn equal 48%
    : I can read it but need a simple example on how to implement it.
    :
    : I read a line in the pricefile, this line contains different info,
    : like number, text and discount code, so I have to determine the
    : discount everytime I read a line, but would like to make the work as
    : little as possible, since I have to read around 108.000 lines and
    : work on them, any suggestions?
    :
    : regards
    : John
    :
    Good day

    If I were u I'd use a record with too fields...
    Type
    Priceline = Record
    Code : String[3];
    Discount : Real;
    End;

    Using this u can easily make a search function that can find the discount % by searching for the code....

    This also makes it very easy to change the percentages later on when u need it...
    Darkwing Duck aka DWduck signing off :)
Sign In or Register to comment.