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:

#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;

}

Recommended Answers

All 4 Replies

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?

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.

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 :D

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.