Skip to main content

How to replace a digit/letter into a string in C++ ?? ||Source code||

Open Source

#include <bits/stdc++.h> using namespace std; int main() { std::string s = "abc"; s[1] = '5'; //replacing std::cout << s; return 0; }

Quote: “There is nothing more dreadful than the habit of doubt. Doubt separates people. It is a poison that disintegrates friendships and breaks up pleasant relations. It is a thorn that irritates and hurts; it is a sword that kills.” ― Buddha Siddhartha Guatama Shakyamuni