В тексте заменить слова "компьютер" на "к*******р
Добавлено: 05 авг 2015, 16:18
Задача: заменить в тексте слова "компьютер" на "к*******р"
Подскажите, что не правильно
Подскажите, что не правильно
Код: Выделить всё
#include <iostream>
#include <cstdlib>
#include <fstream>
#include <cstring>
using namespace std;
int main()
{
setlocale(LC_CTYPE,"RUS");
int const N = 10;
char str[500];
char a[N] = "компьютер";
char b[N] = "к*******р";
ifstream file ("C:\\file.txt");
while(!file.eof())
{
file.getline(str, 500);
for(int i = 0; i < strlen(str); i++){
if(strcmp(str, a)==0){
for(int e = 1; e > N; e++){
a[e] = b[e];
}
}
}
}
file.close();
system("pause");
return 0;
}