Advertisement
Guest User

Untitled

a guest
May 26th, 2015
277
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. #include <cctype>
  3. #include <cstring>
  4. #include <cmath>
  5. using namespace std;
  6.  
  7. void deleteG(char *(msg))
  8. {
  9.     int pos = 0;
  10.     while (isalpha(*(msg + pos)) || isspace(*(msg + pos)))
  11.     {
  12.         if (*(msg) == 'g' || *(msg) == 'G')
  13.         {
  14.             *(msg + pos) = *(msg + pos + 1);
  15.         }
  16.         pos++;
  17.     }
  18. }
  19.  
  20. int main()
  21. {
  22.     char msg[100] = "I recall the glass gate next to Gus in Lagos, near the gold bridge.";
  23.     deleteG(msg);
  24.     cout << msg;  // prints   I recall the lass ate next to us in Laos, near the old bride.
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement