Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.81 KB | None | 0 0
  1. using namespace std;
  2.  
  3. void func(char *str, char symbol)
  4. {
  5.     int del_count = 0, i =0;
  6.    
  7.     while (str[i] != '\0')
  8.     {
  9.         while (str[i+ del_count] == symbol)
  10.             del_count++;
  11.         str[i] = str[i + del_count];
  12.         i++;
  13.     }
  14. }
  15.  
  16. void main()
  17. {
  18.     //char str[] = "aaaabbcacdjaaahsgfrjhdgsaab";
  19.     //func(str, 'a');
  20.  
  21.    
  22.     string str1 = "s43";
  23.     string str2 = "sasdfgy435436htr";
  24.    
  25.     cout << str1.find(' ');
  26.    
  27.     str1.resize(40, '3');
  28.     str1.append("2354");
  29.     cout << str1[42] << '\n';
  30.     cout << str1.c_str() << '\n';
  31.  
  32.     //cout << (str1.find("te")) << '\n';
  33.     try {
  34.         cout << str1.capacity() << '\n';
  35.         cout << str1.length() << '\n';
  36.     }
  37.     catch (exception ex)
  38.     {
  39.         cout << ex.what();
  40.     }
  41.  
  42.      
  43.     std::cout << str1.c_str() << '\n';
  44.     std::cout << str1.length() << '\n';
  45.     std::cout << str2.length() << '\n';
  46.     system("pause");
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement