#include<iostream>
#include <string>
using namespace std;
int main()
{
string str;
string str2="Prograd";
string str3="is a community":
str.append(str2);
str.append(str3, 6, 3);
str.append(str3.begin() + 6, str3.end());
str.append(5, 0x2E);
cout << str << '\n';
return 0;
}
个
Answers
Answered by
2
Answer
The correct códe:
#include<iostream>
#include <string>
using namespace std;
int main()
{
string str;
string str2="Prograd";
string str3="is a community";
str.append(str2);
str.append(str3, 6, 3);
str.append(str3.begin() + 6, str3.end());
str.append(5, 0x2E);
cout << str << '\n';
return 0;
}
Output of the above códe:
Progradommommunity...
Explanation:
In the above program, We are adding characters to the string, So the output will as follows after addition of characters.
$ g++ str.cpp
$ a.out
Progradommommunity...
Have a look on the above attachment :)
Attachments:
Similar questions