CJCoding With Joseph
15per day
← Back to Question List
C++ Code Walkthrough #5

String Manipulation

easyPrinting

📄 Code

Read carefully — what does this print?
1#include <iostream>
2#include <string>
3using namespace std;
4 
5int main() {
6 string s = "Hello";
7 s[0] = 'J';
8 s += "!";
9 cout << s << endl;
10 cout << s.length() << endl;
11 return 0;
12}

🎯 Your Answer