I'm trying to write a program that opens file , which contains a set of numbers. The program should then read the contents of the file into an array but it only opens the file and doesn't read any of the data. Is there something wrong with my code? I would really appreciate any help.
There is nothing wrong with your code. the first one.
Just make sure the text file you want your program to read from is named "numbers" and saved in the same directory/location as your cpp source code
i.e
if your source code is located at c:\users\username\documents\mycode
the text file should also be saved at c:\users\username\documents\mycode