i am totally new to the c++ arena.
i have been tasked with writing a program that asks for a number, asks for that many names, in the form, "last, first," sorts the names by last name, but displays them in the form, "first, last," then offers the user the chance to search for a first name.
i don't want someone to do it for me, but i am having trouble getting started.
i know i need a multi-dimensional array system.
how do i initialize it if i don't know how many names there will be?
if i want to write a sort function, how to i call a multi-dimensional array and return a new array from it?
this project has inspired me to switch majors.
Jump to Post
To be able to help you best we need to know what tools you have available. For example if you don't know the first thing about the Standard Template Library then Ancient Dragon's solution isn't going to help much.
If you don't know STL then you'll need to use …
Jump to Post
I agree with the struct/class recommendation, but if you don't know how to use them you can still solve the problem. Using a vector of vectors or multidimensional array or "parallel" vectors (or arrays) would all do the trick, but not as smooth as using a vector (or array) of …
All 8 Replies
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.