i ve got another question.
how can I find and then print out vector elements i am looking for. i figure it out with one element. like this
1 2 3 4 5 6 7 8
cout <<"insert x "; // x is thing i am looking for in vecotr
if (find(j.begin(), j.end(),x)!= j.end())
ch = find(j.begin(), j.end(),x); // iterator
int nPosition ;
cout << "npositon is : " <<nPosition;
but what if i have in vector j two times the same name of something for example like this in some kind of loop
well i rather would find the position where in vector it is situated.. because i have bunch of other vectors and i need print all of the others out on the exact same position. so i have vector name and than vector lastName and when i have mike smith then george mcdonald and then mike rodgers and i want to find mikes.. mike is situted at name then smith is situated at lastName george name and next mike name and rodgers lastName and i need to find just that position where all of the mikes are situated then i use for loop to print all of the other information of every mike...
well i did use class but i also have option to delete those information and it was told to me that you can t delete while using classes and then they said that i should use vectors.. and now you are going to tell me to use classes.. :D i did object array but you can t delete one object from array.. at least that what they told me..
yeah you are right and i want to use struct after this will work. i know it sounds weird but i want to learn more than just one way of doing things and i know that there has to be way how to do it. but thx.
that is exactly what i need. second link is awesome and i am ashamed that i didn t think of this by myself. and about my example. the very first source code i wrote it works i compiled it and it works but it finds only first index of the element so whenever i have more than one it just doesnt work. but it keeps buging me now why i couldn t thing of simple loop. anyway... thank you very much... i appreciate it.. :)