thanks for looking at this in advance. I can get my code to compile correctly and whatnot, but when running I get stuck in an infinite seeming loop and I have to exit out manually every time. I am new to reading in data from files and I think that is probably my error but any help looking at my code would be appreciated.
In the interest of not submitting some giant file, I'm only going to submit my main function because I assume the error is in there, I'm just not sure of where.
4 #include "class.h"
5 #include <fstream>
6 using namespace std;
7
8
9 int main()
10 {
11 ifstream external; //declaring input stream for my external file
12 //external.open("external.txt"); //telling the compiler what the source of my external file is called
13 //external.close();
14
15 char time[4], course[4], section[3]; //places to store read in values
16 char dept_name[20];
17
18 table hash_table; //instance of my class
19
20 while(!external.eof()) //while it is not the end of the file
21 {
22 external.open("external.txt"); //opens file from location
23
24 external.getline(dept_name, 20); //grabs the info to be input
25 external.getline(time, 4);
26 external.getline(course, 4);
27 external.getline(section, 3);
28
29 external.close(); //closes file until new one must begin
30
31 cin.ignore(5, '\n'); //ignores five characters until next course
32 hash_table.insert(dept_name, course, section, time); //inserts to table
33 }
34 hash_table.display_all();
35 }