#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;
int main()
{
// Номер 1
vector <string> days;
for (int i = 0 ; i < 7 ; ++i)
{
string temp;
cin >> temp;
days.push_back(temp);
}
//Номер 2
int max1 = -2000000000;
int max2 = -2000000000;
vector <int> arr { 15, 48, 0, 144 , 52};
for(int i = 0 ; i < arr.size() ; ++i)
max1 = (arr[i] > max1 ? arr[i] : max1);
for(int i = 0 ; i < arr.size() ; ++i)
max2 = (arr[i] > max2 && arr[i] != max1 ? arr[i] : max2);
cout << "Максимум 1: " << max1 << " Максимум 2: " << max2;
//Номер 3
vector <int> numbers { 15, 24, 48, -5 , 0 , -10};
cout << count_if(numbers.begin(), numbers.end(), [] (int a) { return a > 0;});
return 0;
}
Program Stroka
uses Сrt;
var s,temp:string;
i,c,k,d:integer;
begin
clrscr;
write('Введите строку:');
readln(s);
write('Введите длину:');
readln(k);
temp:=''; c:=0;
d:=length(s);
for i:=1 to d do
begin
if s[i]<>' ' then temp:=temp+s[i];
if ((s[i]=' ') or (i=d)) and (temp<>'') then
begin
if Length(temp)=k then c:=c+1;
temp:='';
end;
end;
writeln('Количество слов заданной длины: ',c);
readkey;
end.