Hello, I made a program that finds all the words in my .txt file and shows them to the screen, but now I want to make it so that I can pick a word from the .txt file and replace it with something else. For example :
teksts.txt has the words "dog, cat, bird" in it,
I want to choose the word "cat" and replace it with the word "rat".
Is there a simple way I can do it with useing this code as the base?
Im new to this, been looking all day, but couldnt figure it out.
I really need the help :(
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main() {
string line = " ";
ifstream fails;
fails.open("teksts.txt");
while (getline (fails, line) )
{
cout << line << '\n';
}
fails.close();
std::cin.get();
return 0;
}