int createStudentList(StudentList& list1,int amount) //see project description for further info { if(amount==0) cout << "It's not logical to add 0 members to the list, is it?" << endl; else { srand (time(NULL)); for(int i=0; i<amount; i++) { StudentNode* std=new StudentNode("RANDOM"); list1.addStudent2list(std); //see addstudent2list description for further info } cout << "Random List Creation Ended Successfully!" << endl; return 1; } return 0; }
int createStudentList(string filename, StudentList& list1) //See project description for further info { ifstream txtread; txtread.open(filename); if(!txtread) //controlling whether it's working or not { cout << "Cannot open/read file" << endl; return -1; } cout << "File is open" << endl; while(!txtread.eof()) //Read Until EOF { StudentNode* std=new StudentNode(txtread); list1.addStudent2list(std); //see addstudent2list description for further info } system("PAUSE"); return 0; }