Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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++.

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

101 Database Exercises Text Workbook

Authors: McGraw-Hill

2nd Edition

0028007484, 978-0028007489

More Books

Students also viewed these Databases questions

Question

6. Have you used solid reasoning in your argument?

Answered: 1 week ago