0

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
main
{
cout>> "Please enter name :";
cin<< name;
cout>>Please enter phone number :";
cin<<phone;
get.char();
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.

Edited by Nick Evan: Added code-tags

2
Contributors
1
Reply
3
Views
7 Years
Discussion Span
Last Post by Nick Evan
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.