User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 456,611 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,453 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C++ advertiser: Programming Forums
Views: 879 | Replies: 5 | Solved
Reply
Join Date: Oct 2007
Posts: 3
Reputation: AXAsianXie is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
AXAsianXie AXAsianXie is offline Offline
Newbie Poster

Help C++ Address book

  #1  
Nov 7th, 2007
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'
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Aug 2005
Location: near St Louis, Missouri, USA
Posts: 11,541
Reputation: Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of 
Rep Power: 40
Solved Threads: 972
Moderator
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Most Valuable Poster

Re: C++ Address book

  #2  
Nov 7th, 2007
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.
<<Freelance Programmer>> << Hobby Site>>
Signature links for sale. PM me for details
Reply With Quote  
Join Date: Nov 2007
Posts: 10
Reputation: bStiffler582 is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 1
bStiffler582 bStiffler582 is offline Offline
Newbie Poster

Re: C++ Address book

  #3  
Nov 7th, 2007
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.
Reply With Quote  
Join Date: Oct 2007
Posts: 3
Reputation: AXAsianXie is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
AXAsianXie AXAsianXie is offline Offline
Newbie Poster

Re: C++ Address book

  #4  
Nov 7th, 2007
lol yea i think i sit in the backrow i think i sit next to you
Reply With Quote  
Join Date: Sep 2004
Posts: 6,515
Reputation: Narue has much to be proud of Narue has much to be proud of Narue has much to be proud of Narue has much to be proud of Narue has much to be proud of Narue has much to be proud of Narue has much to be proud of Narue has much to be proud of Narue has much to be proud of Narue has much to be proud of 
Rep Power: 31
Solved Threads: 489
Super Moderator
Narue's Avatar
Narue Narue is offline Offline
Expert Meanie

Re: C++ Address book

  #5  
Nov 8th, 2007
...
I'm here to prove you wrong.
Reply With Quote  
Join Date: Dec 2005
Posts: 3,834
Reputation: Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of 
Rep Power: 23
Solved Threads: 436
Colleague
Salem's Avatar
Salem Salem is offline Offline
banned

Re: C++ Address book

  #6  
Nov 8th, 2007
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".
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb C++ Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the C++ Forum

All times are GMT -4. The time now is 7:20 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC