SHARE
TWEET

Untitled

a guest Jul 19th, 2019 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     char str [50];
  2.     char k = 0;
  3.     char i = 0;
  4.     cout << "Enter text ";
  5.     cin.getline(str, 50);
  6.     while (str[i]!='\0')
  7.     {
  8.         if (str[i] == ' ' && str[i + 1] == ' ')
  9.                    { ++i; }
  10.         else {str[k] = str[i];
  11.                 ++i;
  12.                 ++k;
  13.              }
  14.        
  15.     }
  16.     str[k] = '\0';
  17.     printf(" a %s %d \n", str,i);
  18.     if (str[0] >= 'a' || str[0] <= 'z')
  19.     str[0] -= 'a'-'A';
  20.     printf(" A %s %d \n",  str,k);
  21.     system("pause");
  22.     return 0;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top