Can't get program to read from file right

My last homework for the semester is to write a program that lets the user enter 5 numbers and store them in a file, then write a program that reads the 5 numbers from that file. I got the program to write the numbers to file working fine, but I can't get the program to read them working. I really appreciate any help, I need this homework to get an A.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <stdio.h>
#include <iostream>
#include <stdlib.h>

using namespace std;

int main()
{
    FILE *pRead;
    int numbArray[5];
    int count = 0;

    pRead = fopen("student2.txt", "r");
    if(pRead == NULL)
    {
        printf("file not opened \n");
    }
    else
    {
        for(count = 0; count < 5; count++)
        {
        fscanf(pRead, "%d", &numbArray);
        printf("%d\n"), numbArray;
        }
        fclose(pRead);
    }
    system("pause");
    return 0;

}
I figured out my problem. I had a misplaced closing brace on line 23 and I was missing the [count] on both lines 22 and 23.
Topic archived. No new replies allowed.