// CSC 234 Project 1.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <iomanip>
#include <string>
#include <fstream>
using namespace std;
void classArray(string studentNames[], int size);
int main()
{
const int SIZE = 4;
string students[SIZE];
classArray(students, SIZE);
return 0;
}
void classArray(string studentNames[], int size)
{
const int ROWS = 4;
const int COLS = 4;
int studentGrades[ROWS][COLS];
ifstream inputFile;
inputFile.open("StudentNames.txt");
while (!inputFile.eof())
{
for (int i = 0; i < size; ++i)
{
inputFile >> studentNames[i];
}
}
ifstream inputFile2;
inputFile2.open("Grades.txt");
while (!inputFile2.eof())
{
for (int i = 0; i < ROWS; ++i)
{
for (int j = 0; j < COLS - 1; ++j)
{
inputFile2 >> studentGrades[i][j];
}
}
}
for (int i = 0; i < size; ++i)
{
for (int j = 0; j < ROWS; ++j)
{
cout << studentNames[i] << " " << studentGrades[i][j] << endl;
}
}
inputFile2.close();
inputFile.close();
}
/*void classArray()
{
const int SIZE = 4;
string studentNames[SIZE];
ifstream inputFile;
inputFile.open("StudentNames.txt");
while (!inputFile.eof())
{
for (int i = 0; i < SIZE; ++i)
{
inputFile >> studentNames[i];
cout << studentNames[i] << " ";
}
}
cout << endl;
inputFile.close();
}*/
Ly8gQ1NDIDIzNCBQcm9qZWN0IDEuY3BwIDogRGVmaW5lcyB0aGUgZW50cnkgcG9pbnQgZm9yIHRoZSBjb25zb2xlIGFwcGxpY2F0aW9uLgovLwoKI2luY2x1ZGUgInN0ZGFmeC5oIgojaW5jbHVkZSA8aW9zdHJlYW0+CiNpbmNsdWRlIDxpb21hbmlwPgojaW5jbHVkZSA8c3RyaW5nPgojaW5jbHVkZSA8ZnN0cmVhbT4KCnVzaW5nIG5hbWVzcGFjZSBzdGQ7Cgp2b2lkIGNsYXNzQXJyYXkoc3RyaW5nIHN0dWRlbnROYW1lc1tdLCBpbnQgc2l6ZSk7CgppbnQgbWFpbigpCnsKCWNvbnN0IGludCBTSVpFID0gNDsKCglzdHJpbmcgc3R1ZGV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3R1ZGVudE5hbWVzW1NJWkVdOwoKCWlmc3RyZWFtIGlucHV0RmlsZTsKCglpbnB1dEZpbGUub3BlbigiU3R1ZGVudE5hbWVzLnR4dCIpOwoKCXdoaWxlICghaW5wdXRGaWxlLmVvZigpKQoJewoJCWZvciAoaW50IGkgPSAwOyBpIDwgU0laRTsgKytpKQoJCXsKCQkJaW5wdXRGaWxlID4+IHN0dWRlbnROYW1lc1tpXTsKCQkJY291dCA8PCBzdHVkZW50TmFtZXNbaV0gPDwgIiAiOwoJCX0KCX0KCgljb3V0IDw8IGVuZGw7CglpbnB1dEZpbGUuY2xvc2UoKTsKfSovCgo=
prog.cs(5,0): error CS1024: Wrong preprocessor directive
prog.cs(6,0): error CS1024: Wrong preprocessor directive
prog.cs(7,0): error CS1024: Wrong preprocessor directive
prog.cs(8,0): error CS1024: Wrong preprocessor directive
prog.cs(9,0): error CS1024: Wrong preprocessor directive
prog.cs(10,6): error CS1525: Unexpected symbol `namespace', expecting `identifier' or `static'
prog.cs(10,19): error CS1525: Unexpected symbol `;', expecting `identifier' or `static'
prog.cs(12,36): error CS1514: Unexpected symbol `[', expecting `.' or `{'
prog.cs(12,36): error CS1525: Unexpected symbol `]', expecting `identifier' or `static'
prog.cs(18,22): error CS1525: Unexpected symbol `;'
Compilation failed: 10 error(s), 0 warnings