I need major help, I'm trying to create three functions to search through a list container: one is to search, one is to flip and the other is to modify.

It's an information manager which has card that contains information such as first name, last name, address, occupation and phone number( don't need help there since I already created the card class which creates the cards).

My problem is with the Rolodex class which manages these cards.
I created a list container--> std::list < string > rolodex;
i also created matching iterator std::list < string >::iterator iter;

my problem is with the Flip(), Search() and Modify() functions.

Rolodex::Search()
{
	string last;
	cout << "Enter last name :          ";
	cin >> last;
	std::list < string >::iterator location;
	location = std::find(rolodex.begin(), rolodex.end(), last);
	.......

i started the flip but can't continue

void Rolodex::Flip()
{
	std::list < string>::iterator iter = rolodex.begin();
	rolodex.push_back(*iter);
    
}

i cant come up with the rest. here is what they are supposed to do:

flip - updates the current position to the next card, and displays it. Flipping past the last card wraps around to the first card.flip - updates the current position to the next card, and displays it. Flipping past the last card wraps around to the first card.

search - finds and displays a card, and makes it the current position in the rolodex. This command prompts for the last name for searching. If a matching card is found, it is displayed and is set as the current position. If no matching card is found, the card that immediately follows the lookup name is displayed and set as the current position (e.g. if "H" is entered as the last name, the first card with a last name following "H" in alphabetical order is displayed). If there is no following card, displays "Couldn't find: name"

modify - updates the card at the current position. Enters a mode that requests the field to be updated (e.g. phone #), displays the existing value and prompts for the new value, reads it, and updates the card. Continues prompting for additional changes until all changes are done (e.g. a 0 is entered for the field # to change). If the last name is changed, the card must be moved to the correct position in the rolodex (and is set as the current position).

Recommended Answers

All 2 Replies

why are you using std::list< std::string > rolodex instead of std::list< Card > rolodex ?

why are you using std::list< std::string > rolodex instead of std::list< Card > rolodex ?

because i wanted to store string objects in the list but i think i will have to change that because it's the main function that is suppose to call the string cardinfo() function.

but what i'm really having problem with is the search, modify and flip functions.

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.