How would I read each line from a *.txt and compare it to a user input string?
I can take a *.txt and compare the contents to a string so long as the file contains only one line but I have no idea how to do this with multiple lines.
I am trying to have the program accept user input and see if the *.txt file contains a matching word.
#include <iostream>
#include <fstream>
#include <string>
int main()
{
std::ifstream file ("input.txt");
std::string a, b;
//To get a line from the file:
std::getline(file, a);
//To get a line from user input
std::getline(std::cin, b);
//...
}