Advertisement
Guest User

Untitled

a guest
Jul 29th, 2015
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.33 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <string.h>
  4. #include <algorithm>
  5. #include <numeric>
  6. #include <mem.h>
  7.  
  8. using namespace std;
  9.  
  10. //char* del_in_str(char* a, char* b)
  11. //{
  12. //        char * At=0;
  13. //        char * Nt=0;
  14. //        for (char * Bt=b; *Bt; Bt++)
  15. //        {
  16. //
  17. //                    if (_Pred(At))
  18. //                        *Nt++=*At;
  19. //                *Nt='\0';
  20. //        }
  21. //
  22. //        return a;
  23. //}
  24.  
  25. inline double sqrt(double a){return a * a;}
  26.  
  27. class erase_in
  28. {
  29.     string str;
  30.  
  31. public:
  32.     erase_in(const string &_str) : str(_str) {}
  33.  
  34.     bool operator () (const char &obj)
  35.     {
  36.         bool xxx = str.find(obj) != string::npos;
  37.         return xxx;
  38.     }
  39. };
  40.  
  41. string& del_in_string(string &a, string &b)
  42. {
  43.  
  44.         string::iterator I = remove_if(a.begin(), a.end(), erase_in(b));
  45.  
  46.         char mmm = *I;
  47.  
  48.         a.erase(I, a.end());
  49.  
  50.         return a;
  51. }
  52.  
  53. int main()
  54. {
  55.         char St[] = "в лесу";
  56.         char Qt[] = " с";
  57.  
  58.         string Str1 = "abcdefg";
  59.         string Str2 = "b";
  60.  
  61. //        char* Resolt = del_in_str(St, Qt);
  62.         string ResUlt = del_in_string(Str1, Str2);
  63.  
  64. //        cout << "abcdefg\n\n";
  65. //        cout << Resolt << " -resolt\n";
  66.         cout << ResUlt;//" -resUlt\n";
  67.  
  68.         cin.get();
  69. //        system("pause");
  70.         return 0;
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement