• Free Pascal question.

    From ignatius@46:1/124 to All on Wed Sep 2 00:14:52 2015
    First off, let me say that I hope this is the right base for this. And also, i'm just about a complete newbie to (Free) Pascal.

    I have a constant:

    Const
    q1 : integer = 0;
    q2 : integer = 0;
    q3 : integer = 0;
    q4 : integer = 0;
    q5 : integer = 0;

    And I have a counter:

    If s = '1' then Inc (q1, 1);
    If s = '2' then Inc (q2, 1);
    If s = '3' then Inc (q3, 1);
    If s = '4' then Inc (q4, 1);
    If s = '5' then Inc (q5, 1);

    My question is this: How would I "save" the values of q1 through q5 and then retrieve them when I want? Any and all help is greatly appreciated.

    Thanks,

    |09ignatius |15(|07cia|15)|07

    --- Iniquity v2.20 Alpha [DOS]
    * Origin: catch twenty two >> >>> > (46:1/124)
  • From wkitty42@46:1/132 to ignatius on Wed Sep 2 12:40:11 2015
    On 09/02/15, ignatius said the following...

    First off, let me say that I hope this is the right base for this. And also, i'm just about a complete newbie to (Free) Pascal.

    I have a constant:

    for your use case, you really should use a var... constants do not change
    their values... that's why they are constant ;)

    when you increment the count, the new value is in the var you incremented...
    so q1 starting off as zero, when incremented by 1 now holds the value of 1...

    i'm not sure what you mean by saving the values, though... are you speaking
    of putting them into a data file and reading them back later??

    --- Mystic BBS v1.10 A57 (Windows)
    * Origin: (46:1/132)
  • From ignatius@46:1/116 to wkitty42 on Wed Sep 2 16:54:01 2015
    for your use case, you really should use a var... constants do not change their values... that's why they are constant ;)


    Ahh.

    i'm not sure what you mean by saving the values, though... are you speaking of putting them into a data file and reading them back later??


    Just that, save the value somehow. Maybe to disk? Yes, the data file is a text file that has the percentages and number of votes. I want to display that
    file when the user chooses "view results" (of the voting booth).

    Thanks,
    -ignatius

    --- Mystic BBS v1.10 (Linux)
    * Origin: Cyberia BBS | Cyberia.Darktech.Org | Kingwood, TX (46:1/116)
  • From Tiny@46:1/126 to ignatius on Fri Sep 4 08:39:18 2015

    Hello ignatius!

    02 Sep 15 16:54, you wrote to wkitty42:

    Just that, save the value somehow. Maybe to disk? Yes, the data file
    is a text file that has the percentages and number of votes. I want to display that file when the user chooses "view results" (of the voting booth).

    I never wrote a voting booth, but if you check out my file section there
    is a ton of utils I did write (doors, etc) that read and write to both a straight text file, and to a data file.

    Click on "Shawn's Software" on the left menu on my web page. Most of my stuff comes with the source code.


    Shawn


    ... True love is when you spend £50 for an operation on a £5 dog.
    --- GoldED+/W32-MSVC 1.1.5-b20130111
    * Origin: Tiny's BBS - tinysbbs.com (46:1/126)