Aleksandr_Grigoryev

первая и последняя буква

Feb 19th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.51 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.     char str[] = "kek lol orbidol dadasad";
  6.     int i = 0,length;
  7.     bool b;
  8.     do 
  9.     {
  10.         length = 0;
  11.         do
  12.         {
  13.         i++;
  14.         length++;
  15.         }
  16.         while ((str[i - 1] != ' ') && (str[i - 1] != '\0'));
  17.        
  18.         b = true;
  19.         for (int j = 0; j<length / 2; j++)
  20.             if (str[i - length ] != str[i - 2])
  21.                 b= false;
  22.         if (b)
  23.             for (int j = i - length; j<i - 1; j++)
  24.                 cout << str[j];
  25.                 cout << endl;
  26.     }
  27.     while (i < strlen(str));
  28.     system("pause");
  29.     return 0;
  30.  
  31. }
Advertisement
Add Comment
Please, Sign In to add comment