names help

im trying to make the program read from the file with the names and quizzes. im not dont with the program. how do you actually make the program read from the file and print out the name of the student? im starting off with 2 students

heres my code

[code]
#include <iostream>
#include <fstream>
#include <string>
#include <cstdlib>
using namespace std;

const int NUM_STUDENTS = 2;
const int NUM_QUIZZES = 10;
const int NUM_EXAMS = 5;

struct Student
{
string firstName;
string lastName;
int quizzes[NUM_QUIZZES];
int exams[NUM_EXAMS];
};

int main()
{

Student Evaluation[NUM_STUDENTS];
int total = 0;
int grade;

ifstream inStream;
ofstream ofStream;

inStream.open ("C:/Users/xxxx/Desktop/infile.txt");
if(!inStream)
{
cout << "Could not open input file. \n Exiting ..." << endl;
system ("pause");
exit(0);
}

if(!outStream)
{
cout << "Could not open output file. \n Exiting ..." << endl;
system ("pause");
exit(0);
}


for (int index = 0; index < NUM_STUDENTS; index++)
{
cout << "Enter student's first name: ";
inStream >> Evaluation[index].firstName;

cout << "Enter student's last name: ";
inStream >> Evaluation[index].lastName;

for (int i = 0; i < NUM_QUIZZES; i++)
Evaluation[index].quizzes[i]

for (int i = 0; i < NUM_EXAMS; i++)
Evaluation[index].exams[i]
}

[\code]
Last edited on
no help?
Topic archived. No new replies allowed.