The open
method of an input file stream requires the second parameter. Try changing the line:
myfile.open("potentials.txt");
to
myfile.open("potentials.txt", std::ifstream::in);
EDIT: Or just open the file when you declare myfile
like so:
ifstream myfile("potentials.txt");
If this still isn’t working, you are likely not opening the file correctly. E.g. wrong directory. Use a full path to the file.
2
solved myfile.open isn’t working correctly and cout does not show data