make a list using 2D Array

hi guys........i'm shofi. i am beginner in C++.
how can i make list of 'n cities using 2D Array.

Sample screen input/output:

-How many cities do you want to enter?
>>5

-Please enter the names of the 5 cities:
>>New York
>>Chicago
>>Washington DC
>>Boston
>>Seattle

-You entered 5 cities: New York, Chicago, Washington DC, Boston and Seattle

can anyone help me about this .... i don't get from where i can start because i very beginner in C++
thanks
what is the 2nd dimension of that array for, if you only want to save names?
If the OP has been given that as a requirement, then presumably the names are to be stored as char arrays, rather than as STL strings.
@Darkmaster
so how can i do this ....in one-array? .......how?


thanks
shofi
Use an array of std::string objects. Technically, that's a 1D array, although each string object probably contains a char array hidden inside it.
@MikeBoy
can i get some code , please.
i would use a string vector std::vector<std::string> cities;

you can add cities at the end with cities.pushback("New York");
and use cities[0] to get the data.

Topic archived. No new replies allowed.