Can anyone tell me what is wrong with my program? It is not reading the data from the file...
Code://This program is.... #include <iostream> #include <iomanip> #include <fstream> using namespace std; const int numrow = 20; const int numcol = 2; void getts(int[][numcol], int); void printts(int[][numcol], int); int main() { int testscores[numrow][numcol]; getts(testscores, numcol); printts(testscores, numcol); return 0; } void getts(int testscores[][numcol], int size) { ifstream inFile; inFile.open("practicetestscore.dat"); for (int row=0; row < size; row++) { for (int col = 0; col < size; col++) inFile >> testscores[numrow][numcol]>>testscores[numrow][numcol]; } inFile.close(); } void printts(int testscores[][numcol], int size) { cout <<"The testscores are:\n"; for (int row = 0; row < size; row++) { for (int col = 0; col < size; col++) cout << setw(2) <<testscores[numrow][numcol] << setw(2) <<testscores[numrow][numcol] <<endl; } return; }



LinkBack URL
About LinkBacks


