Address book problems....Any advice???

Reply

Join Date: Feb 2006
Posts: 10
Reputation: Whodey is an unknown quantity at this point 
Solved Threads: 0
Whodey Whodey is offline Offline
Newbie Poster

Address book problems....Any advice???

 
0
  #1
Feb 27th, 2006
ok im stuck here atm...what im trying to do is to have the program compile to run in windows..and i have to type in the name...and the program goes into the database and finds the address and puts it onto the screen...just like an address book..

So heres my code..anyone have some advice or tips?
:mrgreen:

  1. #include <map>
  2. #include <string>
  3. #include <iostream>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. map<string,string> addressbook;
  9. pair<string,string> p1("Eric","415 East Arlington");
  10. addressbook.insert(p1);
  11.  
  12. typedef pair<string,string> entry;
  13. map<string,string>::iterator iter;
  14. cout << "What is Eric's address?" << endl;
  15. cout << "" << addressbook["Eric"] << endl;
  16. cout << endl;
  17.  
  18. char response;
  19. std::cin >> response;
  20. return 0;
  21.  
  22. }
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,148
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1435
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Most Valuable Poster

Re: Address book problems....Any advice???

 
0
  #2
Feb 27th, 2006
does it work the way it is intended? If yes, then why fix something that ain't broken? But its obvous that it doesn't do what you want it to do.

What kind of database are you supposed to use? MySql, MS-Access, simple flat-text file? or something else?
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 10
Reputation: Whodey is an unknown quantity at this point 
Solved Threads: 0
Whodey Whodey is offline Offline
Newbie Poster

Re: Address book problems....Any advice???

 
0
  #3
Feb 28th, 2006
Originally Posted by Ancient Dragon
does it work the way it is intended? If yes, then why fix something that ain't broken? But its obvous that it doesn't do what you want it to do.

What kind of database are you supposed to use? MySql, MS-Access, simple flat-text file? or something else?

well what i mean is that the code does work...im just trying to convert it to a address book sorta like.....

u have to type in the name and it finds the there address and pops it up under the name.....sorta like basic...

If im not clear then idk :rolleyes:
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,148
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1435
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Most Valuable Poster

Re: Address book problems....Any advice???

 
0
  #4
Feb 28th, 2006
how do you want to store the data -- or do you want to type evetything in each time you run the program?

Use a loop so that you can enter more than one name/address pair during the same instance of the program.

after asking for Eric's address, use a variable and cin to get the address from the keyboard.
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 10
Reputation: Whodey is an unknown quantity at this point 
Solved Threads: 0
Whodey Whodey is offline Offline
Newbie Poster

Re: Address book problems....Any advice???

 
0
  #5
Feb 28th, 2006
Originally Posted by Ancient Dragon
how do you want to store the data -- or do you want to type evetything in each time you run the program?

Use a loop so that you can enter more than one name/address pair during the same instance of the program.

after asking for Eric's address, use a variable and cin to get the address from the keyboard.

was thinking about storeing it the first time...and thanks for the tips man...it really helps alot
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC