#include <iostream>
#include <fstream>
#include <string>
int main() {
std::ifstream inputFile("example.cpp"); // Replace "example.cpp" with the actual file name
std::string targetWord = "search"; // Replace "search" with the word you want to find
if (inputFile.is_open()) {
std::string line;
int lineNumber = 0;
while (getline(inputFile, line)) {
lineNumber++;
size_t found = line.find(targetWord);
if (found != std::string::npos) {
std::cout << "Word found at line " << lineNumber << ": " << line << std::endl;
}
}
inputFile.close();
} else {
std::cerr << "Unable to open file." << std::endl;
}
return 0;
}