Dasha9716
19.10.2021 10:55

5. Изменить программу так, чтобы она решала следующую задачу. Дано количество яблок в коробке. В классе учится 26 учеников.
Определить сколько яблок достанется каждому ученику и сколько
яблок останется в коробке
Внести в эту задачу изменение:
1. Строке №1 вместо учителя написать свой класс и фамилию имя
2. Строке № 3 написать новый поясняющий текст ( )
3. Строке № 4 и 5 вместо 100 написать 26 текст ( )
4. Строке № 6 написать новый поясняющий текст ( )​

Нажмите на рекламу ниже и сразу увидите ответ
Популярные вопросы:
Ответ:
Фиджиии
12.04.2023 05:34
Const n=10; 
type ar=array[1..n+1] of integer;
var 
a:ar; i,p:integer; 
procedure pr(var a:ar; p:integer; var k:integer);
begin
k:=1;
while a[k]<>p do k:=k+1;
end;
begin
Randomize;
writeln('Массив A:');
for i:=1 to n do
 begin
 a[i]:=random(31);
 write(a[i]:4);
 end;
writeln;
p:=17;
a[n+1]:=p;
pr(a,p,i);
if i<n 
 then writeln('Значение 17 найдено, номер элемента = ',i)
 else writeln('Значения 17 в массиве нет');
end.

Пример:
Массив A:
  14   5   7  17  25  15  28   0  24   0
Значение 17 найдено, номер элемента = 4
0,0(0 оценок)
Ответ:
lelyashramkop028pw
09.01.2021 16:12
Romanf romanf отличник 2013-01-10t16: 13: 22+00: 00 1. подумать над алгоритмом 2. вот сам алгоритм: а. спросить у пользователя значения б. расчитать ответ в. выдать ответ на экран 3. написать код в паскале 4. исправить ошибки компиляции 5. протестировать, вводить разные числа 6. обнаружила, что если вводить числа наугад ответ получается отрицательным иногда 7. вставить код проверки введенных пользователем значений 8. убрать ошибки компиляции 9. протестировать 10. готово а вот и сама программа: program aerobus; uses crt; const totalplace = 160; var businessplaces, economyplaces: integer; businessprice, economyprice: real; totalcharge: real; a,b: integer; correctinput: boolean; begin clrscr; businessplaces: =totalplace div 4; economyplaces: = totalplace - businessplaces; writeln('business places count: ', businessplaces); writeln('economy places count: ', economyplaces); correctinput: =false; while not correctinput do begin write('please input business class ticket price: '); readln(businessprice); if(businessprice> 0) then begin correctinput: =true; end else begin writeln('the price should be a positive number, please try again'); end; end; economyprice: =businessprice/2; writeln('economy ticket price is: ', economyprice: 0: 2); correctinput: =false; while not correctinput do begin write('how many business tickets are left? : '); readln(a); if(a> =0) and (a< =businessplaces)then correctinput: =true; if(a< 0) then begin writeln('please input a positive number or 0, please try again'); end; if(a> businessplaces) then begin writeln('please input a number which is less or equal to the tolal business place count, please try again'); end; end; correctinput: =false; while not correctinput do begin write('how many economy tickets are left? : '); readln(b); if(b> =0) and (b< =economyplaces)then correctinput: =true; if(b< 0) then begin writeln('please input a positive number or 0, please try again'); end; if(b> economyplaces) then begin writeln('please input a number which is less or equal to the tolal economy place count, please try again'); end; end; totalcharge: =(businessplaces-a)*businessprice; totalcharge: =totalcharge+(economyplaces-b)*economyprice; writeln('the total charge is: ', totalcharge: 0: 2); writeln; writeln('press enter to exit'); readln; end.
0,0(0 оценок)
Полный доступ
Позволит учиться лучше и быстрее. Неограниченный доступ к базе и ответам от экспертов и ai-bota Оформи подписку
logo
Начни делиться знаниями
Вход Регистрация
Что ты хочешь узнать?
Спроси ai-бота