daily pastebin goal
16%
SHARE
TWEET

Remember

Akaleaf Sep 23rd, 2018 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. program Remember;
  2.  
  3.  
  4. type
  5.   product = record
  6.     code : integer;
  7.     cost : longint;
  8.     name : string[100];
  9.   end;
  10.  
  11. var
  12.   products : array[1..10] of product;
  13.   answer, answerSecond : char;
  14.   code, i, ii, fullAmountOfProducts : integer;
  15.  
  16.     function mainMenu_1 : shortint;
  17.   begin
  18.     repeat
  19.     write('Enter the product code: ');
  20.     readln(code);
  21.     repeat
  22.     begin
  23.       writeln('Product code: ', code);
  24.       writeln('1. Enter the product name. Last saved name: ', products[code].name);
  25.       writeln('2. Enter the product cost. Last saved cost: ', products[code].cost);
  26.       writeln('3. Enter the another product code...');
  27.       writeln('4. Back');
  28.       readln(answer);
  29.       case answer of
  30.         '1':
  31.         begin
  32.           write('Enter the product name: ');
  33.           readln(products[code].name);
  34.         end;
  35.         '2':
  36.         begin
  37.           write('Enter the product cost: ');
  38.           readln(products[code].cost);
  39.         end;
  40.         '3':
  41.         begin
  42.           break;
  43.         end;
  44.         '4':
  45.         begin
  46.           break;
  47.         end;
  48.       end;
  49.     end;
  50.     until ((answer = '4') OR (answer = '3'));
  51.     until answer = '4';
  52.   end;
  53.  
  54.   function mainMenu_2 : shortint;
  55.   begin
  56.     writeln('Product__________________Cost');
  57.     for i := 1 to 10 do
  58.     begin
  59.       writeln(products[i].name, '__________________', products[i].cost);
  60.     end;
  61.     answer := '0';
  62.   end;
  63.  
  64.   function mainMenu_3 : shortint;
  65.   begin
  66.     writeln('Product__________________Cost');
  67.     for i := 1 to 10 do
  68.     begin
  69.       if (products[i].cost > 1000) then
  70.       begin
  71.         writeln(products[i].name, '__________________', products[i].cost);
  72.       end;
  73.     end;
  74.   end;
  75.  
  76.   function mainMenu_4 : shortint;
  77.   begin
  78.     writeln('Product__________________Cost');
  79.     for i := 1 to 10 do
  80.     begin
  81.       fullAmountOfProducts := fullAmountOfProducts + products[i].cost;
  82.     end;
  83.     writeln('Total amount of products: ', fullAmountOfProducts);
  84.   end;
  85.  
  86.   function mainMenu : shortint;
  87.   begin
  88.     writeln('1. Enter the information about the product');
  89.     writeln('2. See the product list');
  90.     writeln('3. Output products with a value in excess of 1000 rubles');
  91.     writeln('4. Output the total amount of products');
  92.     writeln('5. Close the programm');
  93.     readln(answer);
  94.     writeln();
  95.     case answer of
  96.       '1': mainMenu_1;
  97.       '2': mainMenu_2;
  98.       '3': mainMenu_3;
  99.       '4': mainMenu_4;
  100.     end;
  101.   end;
  102.  
  103.  
  104.  
  105. begin
  106.   repeat
  107.   begin
  108.     mainMenu;
  109.   end;
  110.   until answer = '5';
  111. end.
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top