Issue
INPUT STRING
ABCE
INPUT CHAR
D
OUTPUT STRING
ABCDE
It should run for all sizes , and it should be a standard procedure ie run for all the cases. Can anyone Help me with this? Any help would be appreciated.
Solution
You should try the std::string::insert(..)
. Check out the documentation
#include <iostream>
#include <string>
int main() {
std::string str("ABCE");
std::cout << str << std::endl; // ABCE
str.insert(3, 1, 'D');
std::cout << str << std::endl; // ABCDE
return -1;
}
Answered By - Caglayan DOKME Answer Checked By - Marilyn (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.