#include <iostream>
#include <string>
using namespace std;
int main()
{
string str,sub;
int cnt=0;
cout<<"substr: "; cin>>sub;
cout<<"str: "; cin>>str;
int i=0,j=0;
while (i<str.length()) {
while ((str[i]!=sub[j]) && (i<str.length())) i++;
if (i<str.length()) {
while ((str[i]==sub[j]) && (i<str.length()) && (j<sub.length())) {
i++; j++;
}
if (j==sub.length()) cnt++;
j=0;
}
}
cout<<cnt<<endl;
system("pause");
return 0;
}
во втором примере синус принимает переменную Y как значение? если так, то на 14 строке измените на:
y := Power(2, -x) - Cos(x) + Sin(2*x*y);
Начало
Действие 1
Действие 2
Конец
Можешь написать алгоритмы:
Собирание в школу
Заправление постели
Поливание цветка
И т.д