Advertisement
VictoriaLodochkina

lab 3 z1 part1

Feb 23rd, 2020
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.77 KB | None | 0 0
  1. #include <iostream>
  2. #include <string.h>
  3. #include <stdlib.h>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9.     char* str1=new char[12];
  10.     char* str2=new char[10];
  11.     char *temp1=new char[20];
  12.     char* temp2 = new char[20];
  13.     char* temp3 = new char[8];
  14.     char* symbol = new char;
  15.     int n;
  16.     cout << "Enter str1: " << endl;
  17.     cin >> str1;
  18.     cout << "Enter str2: " << endl;
  19.     cin >> str2;
  20.     cout << "Enter symbol: " << endl;
  21.     cin >> symbol;
  22.     cout << "Enter n: " << endl;
  23.     cin >> n;
  24.     temp1 = _strrev(str1);
  25.     temp1 = strstr(temp1, symbol);
  26.     temp1 = _strrev(temp1); //здесь строка уже прямая с символом на конце
  27.     temp2= _strrev(str2);
  28.     temp2 = strtok(temp2, symbol);
  29.     temp2=_strrev(str2);
  30.     strncat(temp1, temp2, n);
  31.     printf("%s", temp1);
  32.     return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement