Advertisement
Mixail

Untitled

Dec 16th, 2013
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.84 KB | None | 0 0
  1. #include <cstring>
  2. #include <iostream>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     const int MAX = 80;
  8.     unsigned int i = 0, j = 0;
  9.  
  10.     char str1[MAX], str2[MAX];
  11.     char alphabet[26] = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','W','X','Y','Z'};
  12.     bool del_mode = false;
  13.    
  14.  
  15.     cout << "String: ";
  16.     cin.getline(str1, MAX);
  17.  
  18.     ///4.2.1 Words, ending on rd
  19.     for (i = 0; str1[i]; i++)
  20.     {
  21.         if (str1[i] == '(')
  22.             del_mode = true;
  23.  
  24.         if (!del_mode)
  25.         {
  26.             str2[j] = str1[i];
  27.             j++;
  28.         }
  29.  
  30.         if (str1[i] == ')')
  31.             del_mode = false;
  32.  
  33.     }
  34.     str2[j] = '\0';
  35.     cout << "Result: " << str2 << endl;
  36.  
  37.     ///
  38.     cout << endl;
  39.     for (i = 0; i < 26; i++)
  40.         for (j = 0; j < strlen(str1); j++)
  41.         if (str1[j] == alphabet[i] || str1[j] == tolower(alphabet[i]))
  42.             {
  43.                 cout << alphabet[i];
  44.                 break;
  45.             }
  46.     return 0;
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement