Announcement

Collapse
No announcement yet.

heres a new prog, with better stuff than the last i gave you-nimrod

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • heres a new prog, with better stuff than the last i gave you-nimrod

    program displaymag;
    uses crt;
    var magnam :string;
    exit :boolean;
    option :integer;
    name :array[1..20] of string;
    price :array[1..20] of real;
    mag :text;
    key :char;
    pointer :integer;
    nomags :integer;

    procedure readfile;
    begin
    assign(mag,'mfile.dat');
    reset(mag);
    pointer:=1;
    readln(mag,name[pointer]);
    while not eof(mag) do
    begin
    readln(mag,price[pointer]);
    pointer:=pointer+1;
    readln(mag,name[pointer]);
    end;
    nomags:=pointer-1;
    end;

    procedure display;
    begin
    writeln('Please enter the name of the magazine');
    readln(magnam);
    for pointer:=1 to nomags do
    begin
    if name[pointer]=magnam then
    begin
    writeln(name[pointer],' costs ',price[pointer]:6:2);
    key:=readkey;
    end;
    end;
    end;

    procedure displayall;
    begin
    clrscr;
    pointer:=1;
    for pointer:=1 to nomags do
    begin
    writeln('name ',name[pointer],' price ',price[pointer]:6:2);
    end;
    key:=readkey;
    end;

    procedure menu;
    begin
    writeln('`1` Display All Magazines');
    writeln('`2` Display Selected Magazine');
    writeln('`3` Exit');
    readln(option);
    case option of
    1: begin
    displayall;
    end;

    2: begin
    display;
    end;

    3: begin
    exit:=true;
    end;
    end;
    clrscr;
    end;

    {main program}
    begin
    clrscr;
    readfile;
    repeat
    menu;
    until exit;
    end.

  • #2
    Can I suggest you return to Sketching ?

    ------------------
    ____________
    Scouse Git[1]

    "CARTAGO DELENDA EST" - Cato the Censor
    "Our words are backed by empty wine bottles! - SG(2)
    "One of our Scouse Gits is missing." - -Jrabbit

    Comment


    • #3
      What the hell are you talking about?
      "Three word posts suck!" - me

      "...and I never will play the Wild Rover no more..." - Various

      Comment


      • #4
        On the assumption that a Systems Analyst can read Borland Pascal, it appears you mean me.

        The thread author is "Boz", Dickens wrote a book entitled "Sketches by Boz" hence my suggestion that sketching would perhaps be more suited to a CIV forum than a magazine price look-up table. Although I must admit it would not be much more suited...

        ------------------
        ____________
        Scouse Git[1]

        "CARTAGO DELENDA EST" - Cato the Censor
        "Our words are backed by empty wine bottles! - SG(2)
        "One of our Scouse Gits is missing." - -Jrabbit

        Comment


        • #5
          SG - An analyst, not a programmer. I was referring to the glop of stuff at the top of the page. I would never insult a Scouse Git. There are too many of you!
          "Three word posts suck!" - me

          "...and I never will play the Wild Rover no more..." - Various

          Comment

          Working...
          X