Advertisement
Guest User

Untitled

a guest
Jan 16th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.79 KB | None | 0 0
  1.  
  2. #include "pch.h"
  3. #include <iostream>
  4. #include  <stdio.h>
  5. #include<math.h>
  6. using namespace std;
  7. int main(){
  8. char input[1000], out[1000] = { '\0' };
  9. gets_s(input, 1000);
  10. int count = 0;
  11. char *point = input;
  12. char *cyka;
  13. bool check = false;
  14. cyka = strrchr(input, ' ');
  15. puts("1st part");
  16. //  wrg r r 444444444
  17. for (int i = cyka-point; i > -1; i--)
  18. {
  19.     if (input[i] != ' ') count++;
  20.     else if (input[i] == ' ')
  21.     {
  22.         if (input[cyka - point - 4] == input[i] && count == 3)
  23.         {
  24.             strncpy(out, &input[cyka - point - 3], 3);
  25.             puts("out");
  26.             break;
  27.         }
  28.         else if(check==false)
  29.         {
  30.             i -= count;
  31.             check = true;
  32.             count = 0;
  33.  
  34.         }
  35.         else if(check==true&&count!=0)
  36.         {
  37.             strncpy(out, &input[i], count);
  38.             puts("out");
  39.             break;
  40.         }
  41.        
  42.     }
  43. }
  44. system("pause");
  45. return 0;
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement