Advertisement
Guest User

Untitled

a guest
Dec 9th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.67 KB | None | 0 0
  1. int main() {
  2.  
  3.     String s1 = "aaa";
  4.     String s2("Hello");
  5.     String s3(s2);
  6.     String s4 = s1;
  7.     String s5("a");
  8.     String s6;
  9.  
  10.     s1 += s2;
  11.     s2 = s3;
  12.     s3 += s4;
  13.     s4 = "NEU";
  14.  
  15.  
  16.     cout << "1. expected: 'aaaHello' -- output : " << s1 << endl;
  17.     cout << "2. expected: 'l' \t\t-- output : "   << s2[ 2 ] << endl;
  18.     cout << "3. expected: 'Hello' \t-- output : "   << s2 << endl;
  19.     cout << "4. expected: 'Helloaaa' -- output : "   << s3 << endl;
  20.     cout << "5. expected: 'NEU' \t\t-- output : "   << s4 << endl;
  21.     cout << "6. expected: 'a' \t\t-- output : "   << s5 << endl;
  22.     cout << "7. expected: '' \t\t-- output : "   << s6 << endl;
  23.  
  24.  
  25.  
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement