In your if statement
if(!input)
it should look something like this
if(!input.is_open())
That member function checks if the file is open or not.
@ newbiee999, HatchetMan302, and OP, the program is just fine. fault must be in other place(s).
Thanks , but an error here that I do not have to specify the size of the array.
How to read the file without knowing its size?