Question
1.
#include
2.
#include
3.
using namespace std;
4.
int main()
5.
{
6.
string s = "a long string";
7.
s.insert(s.size() / 2, " * ");
8.
cout
What is the output of this program?
1.
#include
2.
#include
3.
using namespace std;
4.
int main()
5.
{
6.
string s = "a long string";
7.
s.insert(s.size() / 2, " * ");
8.
cout
Answer: Option C
Was this answer helpful ?
In this program, We are placing the string based on the size of the string and it is a string hierarchicy.
Output:
$ g++ class2.cpp
$ a.out
a long* string
Was this answer helpful ?
Submit Solution