ifstream file("number.txt");
string num1[500], num2[500], num3[500], dash;
if (!file.is_open())
{
cout << "File not found." << endl;
exit(1);
}
for (int x = 0; file.good(); x++)
{
file >> num1[x];
file >> dash;
getline(file, num2[x]), ',';
getline(file, num3[x]);
cout << "asdasd";
}
for (int x = 0; file.good(); x++) //why doesnt this work?
{
cout << "hi";
}
this function was supposed to see if the user input is in the file. but since it didnt work and i found out it was the 2nd for loop so i tested it by printing out hi. instead all it printed was asdasd.