Hi,
I just like to know, can an input data from user (keyed in) be compared with data contained in a files (.txt). Because, I need to compare one data (string) to so many strings or a group of data (about 100+). Therefore, I like to avoid from using so many "OR" in the code.
If not, is there any suggestion on how to simplify this.
TQ
//Example:
#include<iostream>
#include<string>
using namespace std;
int main()
{
string userdata;
cout << "Please enter the data: ";
cin >> userdata;
if ((userdata=="abc111") || (userdata=="abc112") || (userdata=="abc113") || (userdata=="abc114") || (userdata=="abc115") || (userdata=="abc116"))
cout << "The data is correct";
else cout << "The data is incorrect";
return 0;
}