Details of the parts stored in stock include the following attributes: name, quantity, value of one part. Make a program to solve the following tasks:

  1. Calculate the total cost of the part.
  2. Calculate which parts are in the greatest quantity and which in the smallest.
  3. Display information on the availability of parts of the same type and its quantity.

Help, please, solve this problem for the Console Application (Delphi) Sketched something, but it did not work

program Project2; {$APPTYPE CONSOLE} uses SysUtils; type detal = record a: string[30]; kol, st: integer; end; var a: array [0..99] of detal; n, i, max: integer; begin { TODO -oUser -cConsole Main : Insert code here } write('Kollichestvo detaley '); readln(n); for i:=0 to n-1 do With a[i] do begin write('informacia ob ', i, ' detali: '); readln(a); readln(kol); readln(st); end; max := 0; for i:= 1 to n-1 do if a[max].kol*a[max].st < a[i].kol*a[i].st then max:=i; writeln('iskoma9 detal: ', a[max].a, ' stoimostiu ', a[max].st, ' v kolichestve ', a[max].kol); end. 

Closed due to the fact that off-topic participants Kromster , aleksandr barakin , cheops , αλεχολυτ , Kirill Stoianov 23 Sep '16 at 7:16 .

It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reason:

  • “Questions asking for help with debugging (“ why does this code not work? ”) Should include the desired behavior, a specific problem or error, and a minimum code for playing it right in the question . Questions without an explicit description of the problem are useless for other visitors. See How to create minimal, self-sufficient and reproducible example . " - Kromster, aleksandr barakin, cheops, αλεχολυτ
If the question can be reformulated according to the rules set out in the certificate , edit it .

  • The answer does not give me it, errors pop up - Slepoi_kot
  • What kind? - Sh4dow pm
  • Already there are no errors (restarted delphi), but the action “information about the part” is repeated and the program window itself closes. - Slepoi_kot 1:21 pm
  • Is the program itself correctly written? - Slepoi_kot 1:22 pm

1 answer 1

 begin { TODO -oUser -cConsole Main : Insert code here } write('Kolichestvo detaley '); readln(n); for i:=0 to n-1 do begin write('informacia ob ', i, ' detali: '); readln(a[i].a); readln(a[i].kol); readln(a[i].st); end; max := 0; for i:= 1 to n-1 do if a[max].kol*a[max].st < a[i].kol*a[i].st then max:=i; writeln('iskoma9 detal: ', a[max].a, ' stoimostiu ', a[max].st, ' v kolichestve ', a[max].kol); readln; end; 

Try this

  • Thank you earned _) - Slepoi_kot
  • one
    @Slepoi_kot, to accept the answer as correct, click the checkbox to the left of the answer. You 're welcome ) - Sh4dow