Results 1 to 2 of 2

Thread:

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User sympathetic's Avatar
    Join Date: Nov:2008
    Location:
    Posts: 529

    :

    : , , , , . , :
    - ;
    - ;
    - ;
    - ;
    - - .

    , ???

    Code:
    program Project1;
    
    type
      tured = record
        vid: string[255];
        model: string[255];
        proizvoditel: string[255];
        cena: real;
        kolichestvo: integer;
      end;
    
    var
      F: file of tUred;
      ured: tured;
      ime: string;
    
    // -        ;
    
    procedure NovFail;
    begin
      write('Vavedete imeto na faila:');
      readln(ime);
      assign(f, ime);
      rewrite(f);
      close(f);
      writeln('Failat e sazdaden !');
    end;
    
    // -     ;
    
    procedure Prodajba;
    var
      vid: string[255];
      model: string[255];
      kolichestvo: integer;
      cena:real;
    begin
      write('Vid:');
      readln(vid);
      write('Model:');
      readln(model);
      write('Kolichestvo:');
      readln(kolichestvo);
      write('cena:');
      readln(cena);
    
      assign(f, ime);
      reset(f);
      while not eof(f) do
      begin
        read(f, ured);
        if (ured.vid = vid) and (ured.model = model) then
        begin
          if ured.kolichestvo >= kolichestvo then
          begin
            ured.kolichestvo := ured.kolichestvo - kolichestvo;
            seek(f, filepos(f) - 1);
            write(f, ured);
          end;
        end else
          writeln('Nyama dostatuchno kolichestvo ! Nalichni sa ', ured.kolichestvo,
            ' broya.');
      end;
      close(f);
    end;
    
    
    //-    ;
    
    procedure Dostavka;
    var
      vid: string[255];
      model: string[255];
      kolichestvo: integer;
      cena:real;
    begin
      write('Vid:');
      readln(vid);
      write('Model:');
      readln(model);
      write('Kolichestvo:');
      readln(kolichestvo);
      write('Cena');
      readln(cena);
    
      assign(f, ime);
      reset(f);
      while not eof(f) do
      begin
        read(f, ured);
        if (ured.vid = vid) and (ured.model = model) then
        begin
          ured.kolichestvo := ured.kolichestvo + kolichestvo;
          seek(f, filepos(f) - 1);
          write(f, ured);
        end;
      end;
      close(f);
    end;
    
    
    // -           ;
    
    procedure Smetki;
    var
      vid: string[255];
    
      cena: real;
      kolichestvo: integer;
    begin
      write('Vid:');
      readln(vid);
    
      kolichestvo := 0;
      cena := 0;
    
      assign(f, ime);
      reset(f);
      while not eof(f) do
      begin
        read(f, ured);
        if (ured.vid = vid) then
        begin
          cena := cena + ured.kolichestvo * ured.cena;
        end;
      end;
      close(f);
    
      writeln('Cenata na uredite ot vid ', vid, ' e : ', cena: 0: 2);
    end;
    
    // -        - .
    
    procedure NajEvtin;
    var
      vid: string[255];
      cena: real;
    begin
      write('Vid:');
      readln(vid);
    
      cena := 0;
    
      assign(f, ime);
      reset(f);
      while not eof(f) do
      begin
        read(f, ured);
        if (ured.vid = vid) then
        begin
          if cena = 0 then
            cena := ured.cena
          else
          begin
            if ured.cena < cena then
              cena := ured.cena;
          end;
        end;
      end;
      close(f);
    
      writeln('Uredut ot vid ', vid, ' s nai niska cena e : ', cena: 0: 2);
    end;
    
    
    procedure main;
    var
      nam: integer;
    begin
      repeat
        writeln('Menu');
        Writeln('1-Sazdavane na nov fail');
        Writeln('2-Registrirane na prodajba');
        Writeln('3-Registrirane na dostavka');
        Writeln('4-Presmyatane cenata na nalichnoto kolichestvo ot vsichki uredi ot daden vid');
        Writeln('5-Namirane na ureda ot daden vid s nay-niska cena');
        writeln('0-Izxod');
        write('Izberete<0..5>:'); Readln(nam);
        case nam of
          1: NovFail;
          2: Prodajba;
          3: Dostavka;
          4: Smetki;
          5: NajEvtin;
        else if nam <> 0 then
          writeln('GRESHNA KOMANDA !');
        end;
      until nam = 0;
    end;
    
    
    begin
      Main;
    end.

  2. #2
    Registered User KaiHansen's Avatar
    Join Date: Nov:2007
    Location:
    Posts: 194
    . 0. - , , , , . .reset(f) . , read(f).
    Last edited by KaiHansen; 12th December 2009 at 22:00.
    Alfa Romeo 159 1.9 jTDm 150 Sportwagon
    Nokia Lumia 930

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Copyright © 1999-2011 . .
iskamPC.com | mobility.BG | Bloody's Techblog | | 3D Vision Blog |