Hey guys, I'm new here as I have a final project coming up and can't figure this out.. it sounds fairly simple
let's say I have a text file that reads
"Hello my name is Bob
I am Testing This Program
Hi there Bob"
I'm just using a simple ifstream loop to read the words as a string
is there anyway at all I can tell so that once my loop hits the word "I" so that I can tell that it's on the 2nd line? or when i hit "Hi", that i'm on the 3rd line?
Just incase this might help, my project is based on a Binary Search Tree, and the program is supposed to read the text file, and after each word is read, i'm supposed to have a pointer that points to an Integer that shows what line its on. So once it reads "Bob" over in the 3rd line.. the node "Bob" will have a pointer that points to "2" and then to "1".
so maybe i'm approaching this wrong?
Thanks for any help!
let's say I have a text file that reads
"Hello my name is Bob
I am Testing This Program
Hi there Bob"
I'm just using a simple ifstream loop to read the words as a string
is there anyway at all I can tell so that once my loop hits the word "I" so that I can tell that it's on the 2nd line? or when i hit "Hi", that i'm on the 3rd line?
Just incase this might help, my project is based on a Binary Search Tree, and the program is supposed to read the text file, and after each word is read, i'm supposed to have a pointer that points to an Integer that shows what line its on. So once it reads "Bob" over in the 3rd line.. the node "Bob" will have a pointer that points to "2" and then to "1".
so maybe i'm approaching this wrong?
Thanks for any help!