CJCoding With Joseph
← Back to Question List
C++ Code Walkthrough #29

String Concatenation with to_string

mediumStrings

📄 Code

Read carefully — what does this print?
1#include <iostream>
2#include <string>
3using namespace std;
4int main() {
5 string s = "Score";
6 int n = 42;
7 cout << s + ": " + to_string(n) << endl;
8 return 0;
9}

🎯 Your Answer