#include <iostream> #include <string> int main() { using namespace std;
//1й пункт string s1 = "Computer programming (often shortened to programming) is a process"; for (int i = 2; i < s1.size(); i = i + 3) cout << s1[i]; cout << endl;
//2й пункт string s2 = "Programming involves activities such as analysis, developing understanding"; for (int i = 1; i < s2.size(); i = i + 2) if (s2[i] != 'a' && s2[i] != 'b') s2[i] = 'a'; else s2[i] = 'c'; cout << s2 << endl;
#include <iostream>
#include <conio.h>
#include <string>
using namespace std;
int main()
{
string str;
getline(cin, str);
for (int i = 1; i < str.length(); i++)
{
if (i % 3 == 0)
{cout << str[i] << endl;}
}
_getch();
return 0;
}
2)
#include <iostream>
#include <conio.h>
#include <string>
using namespace std;
int main()
{ string str;
getline(cin, str);
for (int i = 1; i < str.length(); i++)
{
if (i % 2 == 0)
{ if (str[i] != 'a')
{ str[i] = 'a'; }
if (str[i] != 'b')
{ str[i] = 'b'; }
if (str[i] != 'c')
{ str[i] = 'c'; }
}
}
cout << str << endl;
_getch();
return 0;}
#include <string>
int main()
{
using namespace std;
//1й пункт
string s1 = "Computer programming (often shortened to programming) is a process";
for (int i = 2; i < s1.size(); i = i + 3)
cout << s1[i];
cout << endl;
//2й пункт
string s2 = "Programming involves activities such as analysis, developing understanding";
for (int i = 1; i < s2.size(); i = i + 2)
if (s2[i] != 'a' && s2[i] != 'b')
s2[i] = 'a';
else
s2[i] = 'c';
cout << s2 << endl;
return 0;
}