| | |
C++ Address book
Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Oct 2007
Posts: 3
Reputation:
Solved Threads: 0
Hey i have a HW to do an address book storing the names addresses and phone #s and add to address.txt. and the phone is the key so i have to create a search using the phone #. i'm also suppose to use a mygetline function that i don't quite understand yet can someone plz help and give me some ideas.
http://www.cs.fredonia.edu/arnavut/c.../ass4_fa07.pdf
this is the HW link in case u didn't understand what i was saying.
This is what i started with.
#include<iostream.>
using namespace std;
struct Person
{
char Phone[30];
char Address[80];
char Name[50];
};
mygetline(phone); // will read the data up to '\n'
cin.ignore(); // will ignore '\n' and move course one location
mygetline(address); // reads the next input up to '\n'
cin.ignore(); //ignores '\n' and moves course after '\n'
http://www.cs.fredonia.edu/arnavut/c.../ass4_fa07.pdf
this is the HW link in case u didn't understand what i was saying.
This is what i started with.
#include<iostream.>
using namespace std;
struct Person
{
char Phone[30];
char Address[80];
char Name[50];
};
mygetline(phone); // will read the data up to '\n'
cin.ignore(); // will ignore '\n' and move course one location
mygetline(address); // reads the next input up to '\n'
cin.ignore(); //ignores '\n' and moves course after '\n'
The assignment is due Tuesday Nov 8! I hate to inform you but Nov 8 is tomarrow, Thursday. In any event, you are just now starting that assignment ???
Do the program one small step at a time, and compile frequently so that you don't get overwhelmed with errors.
First step is to design the file format. From the looks of that structure each record needs to have the phone, address and name. Since address and/or name can contain spaces I'd suggest surrounding them in the file with quotes or separating them with a comma. The '\n' will be used to separate records.
Next you will need two functions -- one to read a line and save the contents in the structure, probably mygetline() can do that. The other function is to write out the data to the file.
When you get that done, post your results and we'll help with the rest, if you need it. But unfortunately for you I doubt you can complete this assignment by 9:00 am tomarrow morning, which is only 15 hours away in my time zone.
Do the program one small step at a time, and compile frequently so that you don't get overwhelmed with errors.
First step is to design the file format. From the looks of that structure each record needs to have the phone, address and name. Since address and/or name can contain spaces I'd suggest surrounding them in the file with quotes or separating them with a comma. The '\n' will be used to separate records.
Next you will need two functions -- one to read a line and save the contents in the structure, probably mygetline() can do that. The other function is to write out the data to the file.
When you get that done, post your results and we'll help with the rest, if you need it. But unfortunately for you I doubt you can complete this assignment by 9:00 am tomarrow morning, which is only 15 hours away in my time zone.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
May as well just visit http://www.cs.fredonia.edu/cswebpage/, click on the "staff" link, figure out which tutor set the homework and then email them directly with a message saying "the following students would like to submit this answer".
![]() |
Similar Threads
- A C++ Simple Address book (C++)
- Creating a Address Book using Random Access Files (Visual Basic 4 / 5 / 6)
- C++ Address Book (C++)
- Where does Address Book & email hide? (Web Browsers)
- lost address book addresses (OS X)
- Address book deleted? HELP (OS X)
- Saving Address book and Messages in Outlook Express (Windows NT / 2000 / XP)
Other Threads in the C++ Forum
- Previous Thread: Candidate Program
- Next Thread: help plz
| Thread Tools | Search this Thread |
api array arrays based beginner binary bitmap c++ c/c++ calculator char class classes code compile compiler console conversion count data delete deploy desktop developer directshow dll download dynamic encryption error file forms fstream function functions game getline givemetehcodez google graph gui homeworkhelp homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker linux list loop looping loops map math matrix memory news node number output parameter pointer problem program programming project proxy python read recursion recursive return string strings struct temperature template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






