Advertisement
dllbridge

Untitled

Apr 11th, 2025
406
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.01 KB | None | 0 0
  1.  
  2.  
  3.  
  4. #include <iostream>
  5. #include   <string>
  6. using namespace std;
  7.  
  8.  
  9. //////////////////////////////////////////////////////////////////
  10. int main()
  11. {
  12.    
  13.     string s1 = "Akbulatov Maxim Aleksandrovich Sony Pictures";
  14.  
  15.     int n = 0;
  16.  
  17.    
  18.     do {      n  = s1.find(" ", n+2);
  19.            
  20.            if(n == -1) break;
  21.        
  22.            s1.insert(n, ",");
  23.        
  24.     } while(1);
  25.  
  26.     cout << s1 << endl;
  27. }
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  // cout << "n = " << n << endl;
  38.     // 
  39.  
  40.  
  41.  
  42.  
  43. /*
  44.  
  45. #include  <iostream>
  46. #include   <iomanip>
  47. using namespace std;
  48.  
  49. string  s1 = "Lisicin Valerievich";
  50. string  s2 =              "Victor";
  51.  
  52. //////////////////////////////////////////////////////////////////
  53. int main()                                                      //
  54. {
  55.  
  56.     int n = s1.find(" ");
  57.    
  58.     cout << "n = " << n << endl;
  59.  
  60.     s1.insert(n,  s2);
  61.     s1.insert(n, " ");
  62.        
  63.     cout << "s1 = " << s1 << endl;
  64. }
  65.  
  66.  
  67.  
  68.  
  69. */
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83. /*
  84. #include <iostream>
  85. #include  <iomanip>
  86. using namespace std;
  87.  
  88.  
  89. string  s1     =     "SONY 123 Pictures";
  90.  
  91. char   sz2[99] = "Pictures";
  92.  
  93.  
  94. //////////////////////////////////////////////////////////////////
  95. int main()
  96. {
  97.  
  98.  
  99.     for(int i = 0; i < s1.length(); i++)
  100.     {
  101.    
  102.         cout << " s1[" << setw(2) << i << "] = " << s1[i] << endl;
  103.     }
  104.    
  105. return 0;
  106. }
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114. */
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122. /*
  123. #include <iostream>
  124. #include  <string.h>
  125. using namespace std;
  126.  
  127.  
  128. string  s1     =     " SONY___";
  129.  
  130. char   sz2[99] = "Pictures";
  131.  
  132.  
  133. //////////////////////////////////////////////////////////////////
  134. int main()
  135. {
  136.  
  137.     strcat(sz2, s1.c_str());
  138.    
  139.    
  140.     cout << " sz2 = " << sz2 << endl;
  141.    
  142.    
  143. return 0;
  144. }
  145.  
  146.  
  147.  
  148. */
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160. /*
  161.  
  162.  
  163. #include <iostream>
  164. using namespace std;
  165.  
  166.  
  167. string  s1     =     "SONY___";
  168.  
  169. char   sz2[99] = " Pictures";
  170.  
  171.  
  172. //////////////////////////////////////////////////////////////////
  173. int main()
  174. {
  175.  
  176.     s1 += sz2;
  177.    
  178.    
  179.     cout << " s1 = " << s1 << endl;
  180.    
  181.    
  182. return 0;
  183. }
  184.  
  185.  
  186. */
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement