Example 1 — string Prefix Copy
Take first two characters.
#include <iostream>
#include <string>
int main() {
const char* src = "CodeToFun";
std::string t(src, 2);
std::cout << t << '\\n';
return 0;
} How It Works
- Constructor copies two chars.
- Result is a normal std::string.
- Prints Co.

