Witam jak zrobić żeby poprawnie wczytać plik input do stringa .
ala ma kota
ola ma aloeal
kod programu:
#include <iostream>
#include<string>
#include <fstream>
using namespace std;
int main()
{
string tekst;
ifstream stream;
stream.open("input.txt");
// wczytywanie pliku
//
string element,zam;
size_t found;
cout << endl << "Jaka fraze zamienic: ";
cin >> zam;
found = tekst.find(zam);
cout << (int)found << endl;
cout << "Co wstawic" << endl;
cin >> element;
tekst.replace(found,zam.size(),element);
cout << tekst << endl;
system("PAUSE");
return 0;
}
Próbowałem juz kilku sposobow ale nic mi nie wychodzi.