C++ Program Help!!

May 7, 2015 at 3:00am
Write a C++ program to read in from disk file 40 integers into an array. The data should be in a text file to be opened and processed by this program. Determine the largest number and the smallest number in the array. Also find the average of all the numbers in the array.
May 7, 2015 at 7:16am
As I said in this thread ( http://www.cplusplus.com/forum/general/164431/ ), we are not going to do your homework since this is not what this forum is for. If you need help, please post the code you have written and point out where the problems are and what is not working. Then we can surely help you.
Last edited on May 7, 2015 at 7:17am
May 7, 2015 at 8:47am
you can use std::ifstream to get integers from a file:

1
2
3
4
5
6
7
8
9
10
11
12
#include <fstream>

int main() 
{
    std::ifstream file("file.txt");
    while(file.good())
    {
        // read data
    }

    return 0;
}
Topic archived. No new replies allowed.