Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program Remember;
- type
- product = record
- code : integer;
- cost : longint;
- name : string[100];
- end;
- var
- products : array[1..10] of product;
- answer, answerSecond : char;
- code, i, ii, fullAmountOfProducts : integer;
- function mainMenu_1 : shortint;
- begin
- repeat
- write('Enter the product code: ');
- readln(code);
- repeat
- begin
- writeln('Product code: ', code);
- writeln('1. Enter the product name. Last saved name: ', products[code].name);
- writeln('2. Enter the product cost. Last saved cost: ', products[code].cost);
- writeln('3. Enter the another product code...');
- writeln('4. Back');
- readln(answer);
- case answer of
- '1':
- begin
- write('Enter the product name: ');
- readln(products[code].name);
- end;
- '2':
- begin
- write('Enter the product cost: ');
- readln(products[code].cost);
- end;
- '3':
- begin
- break;
- end;
- '4':
- begin
- break;
- end;
- end;
- end;
- until ((answer = '4') OR (answer = '3'));
- until answer = '4';
- end;
- function mainMenu_2 : shortint;
- begin
- writeln('Product__________________Cost');
- for i := 1 to 10 do
- begin
- writeln(products[i].name, '__________________', products[i].cost);
- end;
- answer := '0';
- end;
- function mainMenu_3 : shortint;
- begin
- writeln('Product__________________Cost');
- for i := 1 to 10 do
- begin
- if (products[i].cost > 1000) then
- begin
- writeln(products[i].name, '__________________', products[i].cost);
- end;
- end;
- end;
- function mainMenu_4 : shortint;
- begin
- writeln('Product__________________Cost');
- for i := 1 to 10 do
- begin
- fullAmountOfProducts := fullAmountOfProducts + products[i].cost;
- end;
- writeln('Total amount of products: ', fullAmountOfProducts);
- end;
- function mainMenu : shortint;
- begin
- writeln('1. Enter the information about the product');
- writeln('2. See the product list');
- writeln('3. Output products with a value in excess of 1000 rubles');
- writeln('4. Output the total amount of products');
- writeln('5. Close the programm');
- readln(answer);
- writeln();
- case answer of
- '1': mainMenu_1;
- '2': mainMenu_2;
- '3': mainMenu_3;
- '4': mainMenu_4;
- end;
- end;
- begin
- repeat
- begin
- mainMenu;
- end;
- until answer = '5';
- end.
Advertisement
Add Comment
Please, Sign In to add comment