In this practicle i am unable to find values in one and two | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

In this practicle i am unable to find values in one and two

#include <iostream> using namespace std; #include <string> int main() { string num; cin>>num; string b; cout <<" enter number"; cin >> b; int a; cout << "enter index"; cin >> a; int cnt = int(b.length()); int index = num.find(b); string one="", two=""; for(int i = index; i < index + cnt; i++) { num[i] =' '; } for(int i = 0; i < a; i++) { one[i] = num[i]; } for(int i = a; i < int(num.length()); i++) { two[i - a] = num[i]; } string new1 = ""+ one + b + two; cout << num; }

8th Feb 2023, 7:37 AM
Vishu
1 Answer
+ 1
Not getting the flow. Can you describe or illustrate what the code should actually do?
8th Feb 2023, 8:45 AM
Ipang