4. Generate outputs "Hey, it's about time to go" using substr() function and stringA.at() operator.
string stringA = 'hello, it's nice to meet you'
(Do not take a short cut to print the output such as a = b;)
#include <iostream>
#include <string>
using namespace std;
int main() {
/* Your solution goes here */
return 0;
}
Hey, please find the required code snippet below -
The original string is -
string stringA = 'hello, it's nice to meet you'
And the output string is - Hey, it's about time to go
include <iostream>
#include <string>
using namespace std;
int main() {
String stringA = 'hello, it's nice to meet you';
String s1 = stringA.substr(0,1) + "y" + stringA.substr(5,10) + " ab"+stringA.substr(26,27)+stringA.at(8) + " " +stringA.at(8) +stringA.at(7) + stringA.substr(20,21)+ " " + stringA.substr(17,18)+ " g" + stringA.at(4);
Cout << s1;
return 0;
}
Please feel free to ask any doubt using the comments.
Get Answers For Free
Most questions answered within 1 hours.