I've homework to complete. but unable to finished due to I'm did not have the idea on how to read from a txt file and write back on it.
what I've complete is just entering data via cout and cin. i know that i need to use the fstream and to put in the file in and file out..but i really don't know how.
below is the tiny part of my assignment which I did it at home. I'm at CC. i did not remember the whole lot. but after debug. manage to key in name and phone number.

#include <iostream>	// Needed for cin and cout
cout>> "Please enter name :";
cin<< name;
cout>>Please enter phone number :";
return 0;

BTW this is the question
Write a program that reads a list of names and telephone numbers from a text file and inserts them into an AVL tree. Once the tree has been built, present the user with a menu that allows him or her to search the list for a specified name, insert a new name, delete an existing name, or print the entire phone list. At the end of the job, write the data in the list back to the file. Test your program with at least 10 names.