txt file not in output

I have a txt file added into the source files but the code isn't reading it. I am not getting any error messages.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <iostream>
#include <fstream>
#include <string>
#include "Classroom.h"


using namespace std;

Classroom myLib;

void loadDataset(string fileName) 
{
	ifstream myFile;
	myFile.open(fileName.c_str());
}


void continueMessage(string message) {
	cout << message << endl;
	cout << "Press Enter to continue.." << endl; cin.get();
}

int main() 
{	
	
	string fileName = "dataset.txt";
	loadDataset(fileName);

	myLib.print();
	continueMessage;

	string ID = "Janet Newman";
	myLib.removeStudent (ID);
	continueMessage("Janet Newman has been removed.");
	//---------------------------------------------------------------------------
	myLib.print();
	continueMessage("All students are listed!");

	return 0;
}
Last edited on
but the code isn't reading it


Yup, that's true. There isn't a line in that code that reads anything.
Okay......thanks for your "help".
You need:

(a) Some lines of the form
myFile >> etc.
in loadDataset() to read the contents of the file.

(b) Some means of returning the data you have then read within your Classroom object. Either a return value or an argument of the function loadDataset().
Last edited on
Topic archived. No new replies allowed.