hello,
I have an assignment for my one class at school where I am supposed to write a program that creates lists of people who have met. Each line of input is a space-separated list of the names of people who have met. If a person is in a group with someone, they have met and should be on each other's contact list. The input is multiple lines of groups of people terminated by end-of-file
for example:
beth david mark helen
helen ben faheem eric
mavia sarah mindy
...etc
I am allowed to use any C++ data structures, and I was planning on using a map of strings and sets like map<string, set<string> >,
but I really don't know how to separate the names to store in the sets. Can anyone help me?
fantum
0
Newbie Poster
Recommended Answers
Jump to PostI'm not real sure what your question is. Are you trying to separate the names as you input them? Separating them is the easy part.
The hard part is managing the data after the input. I think you could do something with nested loops and a vector of strings.
…
All 3 Replies
Fbody
682
Posting Maven
Featured Poster
fantum
0
Newbie Poster
Fbody
682
Posting Maven
Featured Poster
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.