hello everyone
i am trying to make a list that contains name with following option
add till name
write out names in the list
remove name from the list
sort the list
look efter a name from the list
save the list to a file

please i will appreciate if i can get tips

First question. Are you allowed to use the Standard Template Library?

thanks for your reply
gerald4143
yes we can do that
i am very hardworking and needs a mentor

Well if your allowed to utilize the list container then its pretty simple

#include <list>

/*creat list*/
std::list<data structure/class> my_list;
/*add to list*/
my_list.push_back(data structure/class);
/*display list*/
copy(my_list.begin(), my_list.end(), std::ostream_iterator<data structure/class>(std::cout, " "));

The rest you can figure out.

gerard4143
thanks but make it simple
i am suppose to input names and stored in vector
after that i am suppose to use another function to write out the names in vector
i am suppose to also use another function to save the vector.
it will be of great pleasure if i you can help me with that.
sorry for asking baby question

gerard4143
thanks but make it simple
i am suppose to input names and stored in vector
after that i am suppose to use another function to write out the names in vector
i am suppose to also use another function to save the vector.
it will be of great pleasure if i you can help me with that.
sorry for asking baby question

No, if you'll check your original posting you said list...

thats correct
but i mean make a name list
here is a code to explain what i mean

void addName()
{
// variable for name input
const int SIZE = 30, SIZE1 = 60;
char f_namn[SIZE] = "";
char last_namn[SIZE]="";
char full_name[SIZE1]="";

/* en vektor that can hold full namn*
vector<string> names;

/* en sentinel used to end input*
string sentinel= "end";
int counter=0;

cout<<" ******************Namelist*****************\n";

/* ask after first name*/
cout << " input first name and stop input with'end': ";
cin>>f_namn; 

/* controll first name before last name input*/

while (for_namn != sentinel) 
{ 

/* input last name*/
cout << " input lastname: ";
cin>>last_name;


strcat(full_name,last_name); 
strcat(full_name," ");
strcat(full_name,f_namn);

names.push_back(full_name); 

/* empty full_name to be able to take new full namn*

*full_name = NULL;


cout << " input first name or end input with 'end': ";
cin>>f_namn; 


}
system("pause");
}

}

sorry for bothering you!!!!!!!!!!!

i should be able to use another function to write it out
another function to sort it
another function to remove a name
another function to save it.

my problem is that i can input names into vector but how do i make it visible in other functions?


thanks in advance!!!!!!!!!!!!

Do you know what a parameter is?

yes i know parameter

my problem is that i can input names into vector but how do i make it visible in other functions?

And how could parameter relate to your question?

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.