He means for them to be in the working directory for the executable of your code. For example, if you ran the executable from one folder, it needs to be in the same folder as the executable is.
Also, you should check if the file is opened before reading:
1 2 3 4 5 6 7 8 9 10
#include <fstream>
// ...
int main() {
std::ifstream inputFile ("File.txt");
if (!inputFile.is_open()) {
// print an error
return 1; // file wasn't opened
}
}
i hope your code isn't big error it only miss spelling because C++ is case sensitive, you created an object from ifstream as object name inputfile
and it is not same as you declared inputfile and the way you used because the character ' f ' is a small when you declared as object name and it is capital when you used.
and also the way you open the file is right
the file is open default in your program location so you have to check if the file is exist in your project folder
and i hope it will be OK if you do this way
thank you