Advertisement
dllbridge

Untitled

Feb 7th, 2022 (edited)
980
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.37 KB | None | 0 0
  1. #include   <stdio.h>
  2. #include  <iostream>
  3. #include    <string>
  4. #include   <cstring>
  5. using namespace std;
  6.  
  7.  
  8. string      s_1   =       "SONY";
  9.  
  10. char     sz_1[73] = "_Pictures.";
  11.  
  12. ////////////////////////////////////////////////////////////////////
  13. int main()                                                        //
  14. {
  15.  
  16.     s_1 += sz_1;
  17.  
  18.     cout << "1: " << s_1 << endl;
  19.  
  20.     printf("The length of \"str_1\" = %d \n", s_1.length());
  21.  
  22.     strcpy(sz_1, s_1.c_str());
  23.    
  24.     printf( "2: %s \n", sz_1);
  25.  
  26. return 0;
  27. }
  28.  
  29.  
  30.  
  31. #include  <iostream>
  32. #include   <iomanip>
  33. using namespace std;
  34.  
  35. string  s1 = "Lisicin Valerievich";
  36. string  s2 =              "Victor";
  37.  
  38. //////////////////////////////////////////////////////////////////
  39. int main()                                                      //
  40. {
  41.  
  42.     int n = s1.find(" ");
  43.    
  44.     cout << "n = " << n << endl;
  45.  
  46.     s1.insert(n,  s2);
  47.     s1.insert(n, " ");
  48.        
  49.     cout << "s1 = " << s1 << endl;
  50. }
  51.  
  52.  
  53.  
  54.  
  55.  
  56. #include <iostream>
  57. #include   <string>
  58. using namespace std;
  59.  
  60.  
  61. //////////////////////////////////////////////////////////////////
  62. int main()
  63. {
  64.    
  65.     string s1 = "Akbulatov Maxim Aleksandrovich Sony Pictures";
  66.  
  67.     int n = 0;
  68.  
  69.    
  70.     do {      n  = s1.find(" ", n+2);
  71.            
  72.            if(n == -1) break;
  73.        
  74.            s1.insert(n, ",");
  75.        
  76.     } while(1);
  77.  
  78.     cout << s1 << endl;
  79. }
  80.  
  81.  
  82.  
  83.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement