|
-
April 6th, 2005, 08:26 AM
#8
Re: wrong order
NoHero...... as i mentioned in my previous post, i cannot use any of those implementations....... got to create my own!
BigEvil....... first example you provided.....
void linklist::readfile()
{
ifstream myFile("textfile.txt");
readnum();
myFile.close();
cout << "All the data has been read from the file." << '\n';
cout << "Press Enter to continue!" << '\n';
getch();
}
void linklist::readnum()
{
if(myFile)
{
int s;
myFile>>s;
readnum();
this->additem(s); // Number read first will be added last
}
}
myFile is not identified as it is declared in the readfile function. I declared on top of the .cpp file and it worked fine (is there any other way i can declare this not globally????)
Otherwise, it worked fine: output was:
5
4
3
2
1
-858993460 <--------- what is this?
Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|