#include <iostream>using namespace std; int main(){ setlocale(LC_ALL, "Russian"); int number=2, number_of_seats=20, full_number, all_people, number_of_standing=10, rashod_all_fuel, number_of_seats__procent, road, number_of_seats_procent, number_of_standing_procent, full_procent, pribl, doroga, coust_fuel, rashod_fuel; cout<<"Введи кількість поїздок"<<endl; cin>>road; full_number=number_of_seats+number_of_standing; full_procent=road*(full_number*0.5); number_of_seats_procent=road*(full_number*0.3); number_of_seats__procent=number_of_seats_procent*0.5; cout<<"Введи проїханий маршут в км"<<endl; cin>>doroga; cout<<"Вартість пального"<<endl; cin>>coust_fuel; cout<<"Расход бензина на 100 км"<<endl; cin>>rashod_fuel; rashod_all_fuel=(road*doroga)*(coust_fuel*rashod_fuel); all_people=number*(full_procent+number_of_seats_procent-number_of_seats__procent); cout<<"Вигода = "<<all_people<<" гривень"<<endl; cout<<"Вигода = "<<all_people-rashod_all_fuel<<" гривень"<<endl; return 0;}
Правельный ответ - г. Так как все остальные являются антивирусными программами.
В программе предполагается, что слова отделяются друг от друга одним пробелом, знаков препинания нет.
const m=3;
var s:string;
sl:array[1..m] of string=('ЗНАЧИТ', 'ВОТ', 'АВТОМОБИЛЬ');
n:array[1..m] of integer;
i:integer;
procedure pr(s1,s2:string; var k:integer);
var l,p:integer;
begin
s1:=' '+s1+' ';
l:=length(s2);
k:=0;
p:=pos(s2,s1);
while p>0 do
begin
if (s1[p-1]=' ')and(s1[p+l]=' ') then k:=k+1;
delete(s1,1,p+l);
p:=pos(s2,s1);
end;
end;
begin
writeln('Введите текст:');
readln(s);
for i:=1 to m do
begin
pr(s,sl[i],n[i]);
writeln(sl[i],' - ',n[i]);
end;
end.
Пример (слов меньше 40):
Введите текст:
ЗНАЧИТ ТАК ВОТ АВТОМОБИЛЬ РАЗ ВОТ АВТОМОБИЛЬ ДВА ВОТ АВТОМОБИЛЬ ТРИ
ЗНАЧИТ - 1
ВОТ - 3
АВТОМОБИЛЬ - 3
720:180 =4 бита - один символ
2^4=16 символов в алфавите (мощность алфавита)
То есть 1 буква это 4 бита.
Много букв = много битов = большой обьём памяти.