944,052 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Marked Solved
  • Views: 1581
  • C++ RSS
Nov 7th, 2007
0

C++ Address book

Expand Post »
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'
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
AXAsianXie is offline Offline
3 posts
since Oct 2007
Nov 7th, 2007
0

Re: C++ Address book

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.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,954 posts
since Aug 2005
Nov 7th, 2007
0

Re: C++ Address book

You're in my class. Who are you? I posted a question about this earlier. I can't get the delete function working.
Last edited by bStiffler582; Nov 7th, 2007 at 9:16 pm.
Reputation Points: 13
Solved Threads: 1
Newbie Poster
bStiffler582 is offline Offline
10 posts
since Nov 2007
Nov 7th, 2007
0

Re: C++ Address book

lol yea i think i sit in the backrow i think i sit next to you
Reputation Points: 10
Solved Threads: 0
Newbie Poster
AXAsianXie is offline Offline
3 posts
since Oct 2007
Nov 8th, 2007
0

Re: C++ Address book

...
Administrator
Reputation Points: 6442
Solved Threads: 1393
Bad Cop
Narue is offline Offline
11,807 posts
since Sep 2004
Nov 8th, 2007
0

Re: C++ Address book

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".
Team Colleague
Reputation Points: 5862
Solved Threads: 950
Posting Sage
Salem is offline Offline
7,164 posts
since Dec 2005

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: overloading operator >>
Next Thread in C++ Forum Timeline: help plz





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC