Question: My program cannot display the output. Please correct any errors that I have in C++. TEXT FILE 321 Jimmy 232 Holly 551 Billy 626 Tony

My program cannot display the output. Please correct any errors that I have in C++.

My program cannot display the output. Please correct any errors that I

TEXT FILE

321 Jimmy 232 Holly 551 Billy 626 Tony 975 David

HEADER FILE

#include

#include

#include

using namespace std;

#ifndef student_h

#define student_h

class student

{

public:

student();

student(string file);

void printstudent(string x);

private:

string filename;

int id[100];

string name[100];

};

student::student()

{

filename = " ";

for (int i = 0; i

{

name[i] = " ";

}

for (int i = 0; i

{

id[i] = 0;

}

}

student::student(string file)

{

filename = file;

fstream inputfile;

inputfile.open(filename);

while (!inputfile.eof())

{

for (int i = 0; i

{

inputfile >> name[i] >> id[i];

}

}

}

void student::printstudent(string x)

{

for (int i = 0; i

{

if (x == name[i])

{

cout

}

}

}

#endif

CPP FILE

#include

#include

#include

#include "student.h"

using namespace std;

int main()

{

string x;

student mystudent ("class.txt");

cout

cin >> x;

mystudent.printstudent(x);

system("pause");

return 0;

}

#include #include "student . h" using namespace std int main) string x; student mystudent (class.txt") cout x; mystudent.printstudent(x); system( pause") return 0

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!