Advertisement
Balda

Untitled

Dec 19th, 2013
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.59 KB | None | 0 0
  1. #include <iostream>
  2. #include <float.h>
  3. #include <string>
  4. #include <Windows.h>
  5.  
  6. using namespace std;
  7.  
  8. void function(char *x, char *y);
  9.  
  10. void function(char *x, char *y)
  11. {
  12.     unsigned int i, j = 0;
  13.     bool C = true;
  14.     for (i = 0; i<strlen(x); i++)
  15.     {
  16.         if (x[i] == ' ')
  17.             C = !C;
  18.         if (C)
  19.         {
  20.             y[j] = x[i];
  21.             j++;
  22.         }
  23.     }
  24.     y[j] = '\0';
  25. }
  26.  
  27. int main()
  28. {
  29.     SetConsoleCP(1251);
  30.     SetConsoleOutputCP(1251);
  31.     char A[50], B[50];
  32.     cout << "Введите строку:\n";
  33.     cin.getline(A, 50);
  34.     function(A, B);
  35.     cout << "Измененная строка::\n";
  36.     cout << B << endl;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement