Untitled

mail@pastecode.io avatar
unknown
c_cpp
11 days ago
384 B
0
Indexable
Never
#include <iostream>
#include <math.h>
using namespace std;

int main() {
	setlocale(LC_ALL, "Russian");
	char a, b;
	string c;
	cout << "Строка: ";
	cin >> c;
	cout << "Какой заменяем: ";
	cin >> a;
	cout << "На что заменяем: ";
	cin >> b;
	for (int i = 0; i < c.length(); i++) {
		if (c[i] == a) {
			c[i] = b;
		}
	}
	cout << c;
}
Leave a Comment