What will be the output of the following code?string str = "Hello World";str.replace(6, 5, "C++");cout << str;"Hello C++""Hello C++ World""C++ World""World C++"
Question
What will be the output of the following code?string str = "Hello World";str.replace(6, 5, "C++");cout << str;"Hello C++""Hello C++ World""C++ World""World C++"
Solution
The output of the code will be "Hello C++".
Similar Questions
What is the output of the following code?string str = "hello";str.insert(1, "123");cout << str;"h123ello""1hello""hello123""h123lo"
What is the output of the following code?string str = "Hello";cout << str.length();4560
What will be the output of the following code?string str = "abcdef";cout << str.substr(2, 3);"abc""def""cde""bcd"
What will be the output of the program?String x = "xyz";x.toUpperCase(); /* Line 2 */String y = x.replace('Y', 'y');y = y + "abc";System.out.println(y);abcXyZabcxyzxyzabcXyZabc
What will the output of the following questions:C++#include <bits/stdc++.h>using namespace std; int main(){ string a = "Hello"; string b = "World"; string c = b.append(a); cout << c << endl; return 0;}Hello worldWorld helloWorldHelloError
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.