| | |
Address book problems....Any advice???
![]() |
•
•
Join Date: Feb 2006
Posts: 10
Reputation:
Solved Threads: 0
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:
So heres my code..anyone have some advice or tips?
:mrgreen:
C++ Syntax (Toggle Plain Text)
#include <map> #include <string> #include <iostream> using namespace std; int main() { map<string,string> addressbook; pair<string,string> p1("Eric","415 East Arlington"); addressbook.insert(p1); typedef pair<string,string> entry; map<string,string>::iterator iter; cout << "What is Eric's address?" << endl; cout << "" << addressbook["Eric"] << endl; cout << endl; char response; std::cin >> response; return 0; }
•
•
Join Date: Feb 2006
Posts: 10
Reputation:
Solved Threads: 0
•
•
•
•
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:
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.
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.
•
•
Join Date: Feb 2006
Posts: 10
Reputation:
Solved Threads: 0
•
•
•
•
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
![]() |
Similar Threads
- Problem encounter by user when use the manual address book system (C)
- 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: Urgent Help
- Next Thread: Creating dynamic arrays
| Thread Tools | Search this Thread |
api array based binary bitmap c++ c/c++ char class classes classified code coding compatible compile console conversion count date delete deploy desktop developer directshow dll download dynamic dynamiccharacterarray email encryption error file filewrite forms fstream function functions game givemetehcodez graph gui homeworkhelp homeworkhelper homeworksolutions iamthwee icon if...else ifstream input int integer java lib linkedlist linker loop looping loops map math matrix memory multiple news node object output play pointer problem program programming project python random read recursion reference rpg string strings struct symbol temperature template test text text-file toolkit tree url values variable vector video win32 windows winsock wordfrequency wxwidgets






