Advertisement
Guest User

Untitled

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