using Visual Studio .NET
console applcation.
Thanks Ejaz, but I cannot use the std::list. (not allowed to!!)
Here is the code for the function used to read from the file:
ThanksCode:void linklist::readfile() { ifstream myFile("textfile.txt"); while(myFile) { int s; myFile >> s; this->additem(s); //adds each number it reads to the linked list } myFile.close(); cout << "All the data has been read from the file." << '\n'; cout << "Press Enter to continue!" << '\n'; getch(); }




Reply With Quote