begin writeln('Введите строку: '); readln(s); if pos('а', s) <> 0 then writeln('В строке есть буква "а"') else writeln('В строке нет буквы "а"'); end.
2) var s: string; i, a: byte;
begin a := 0; writeln('Введите строку: '); readln(s); for i := 1 to length(s) do if s[i] = 'м' then a := a + 1; writeln('В строке буква "м" встречается ', a, ' раз(а)'); end.
3) var s: string;
begin writeln('Введите строку: '); readln(s); while pos('и', s) <> 0 do delete(s, pos('и', s), 1); writeln('Строка после удаления букв(ы) "и": ', s); end.
1) задание
#include <iostream>
using namespace std;
int main(){
int n;
cin >> n;
if(n >= 3 && n <= 5){
cout << "BecHa" ;
}
else if(n >= 6 && n <= 8){
cout << "LeTo";
}
else{
cout << "3uMa";
}
}
2) Задание
#include <iostream>
using namespace std;
int main(){
int a,b;
cin >> a >> b;
char c;
cin >> c;
if(c == '*'){
cout << a * b;
}
else if(c == '/'){
cout << a / b;
}
else if(c == '-'){
cout << a - b;
}
else if(c == '+'){
cout << a + b;
}
return 0;
}
3) задание
#include <iostream>
using namespace std;
int main(){
setlocale(0, "");
int a;
cin >> a;
if(a == 1){
cout << "Философский камень ";
}
else if(a == 2){
cout << "Тайная комната ";
}
else if(a == 3){
cout << "Узник Азкабана ";
}
else if(a == 4){
cout << "Огненный кубок ";
}
else if(a == 5){
cout << "Орден Феникса ";
}
else if(a == 6){
cout << "Принц-полукровка ";
}
else if(a == 7){
cout << "Дары смерти ";
}
else if(a == 8 ){
cout << "Проклятое дитя ";
}
}
var
s: string;
begin
writeln('Введите строку: ');
readln(s);
if pos('а', s) <> 0 then writeln('В строке есть буква "а"')
else writeln('В строке нет буквы "а"');
end.
2)
var
s: string;
i, a: byte;
begin
a := 0;
writeln('Введите строку: ');
readln(s);
for i := 1 to length(s) do if s[i] = 'м' then a := a + 1;
writeln('В строке буква "м" встречается ', a, ' раз(а)');
end.
3)
var
s: string;
begin
writeln('Введите строку: ');
readln(s);
while pos('и', s) <> 0 do delete(s, pos('и', s), 1);
writeln('Строка после удаления букв(ы) "и": ', s);
end.