Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <Windows.h>
- #include <string.h>
- using namespace std;
- void del_char(char* str, char ch) {
- char* temp = new char[strlen(str) + 1];
- int k = 0;
- for (int i = 0; i <= strlen(str); i++) {
- if (str[i] != ch) {
- temp[k++] = str[i];
- }
- }
- strcpy(str, temp);
- delete[] temp;
- }
- int main() {
- SetConsoleCP(1251);
- SetConsoleOutputCP(1251);
- char line[100];
- cout << "Введите строку: ";
- gets_s(line);
- char ch;
- cout << "Введите символ: ";
- cin >> ch;
- del_char(line, ch);
- cout << line;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement