Click here to Skip to main content
15,915,781 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How to make a CStatic control to support mouse selection( can be copied) Pin
CPallini19-Aug-08 20:58
mveCPallini19-Aug-08 20:58 
JokeRe: How to make a CStatic control to support mouse selection( can be copied) Pin
Rajesh R Subramanian19-Aug-08 22:08
professionalRajesh R Subramanian19-Aug-08 22:08 
GeneralRe: How to make a CStatic control to support mouse selection( can be copied) Pin
CPallini19-Aug-08 22:21
mveCPallini19-Aug-08 22:21 
GeneralRe: How to make a CStatic control to support mouse selection( can be copied) Pin
Stephen Hewitt24-Jul-08 15:56
Stephen Hewitt24-Jul-08 15:56 
QuestionWhere to put registration data? Pin
robotz24-Jul-08 7:24
robotz24-Jul-08 7:24 
AnswerRe: Where to put registration data? Pin
vikas amin24-Jul-08 11:35
vikas amin24-Jul-08 11:35 
GeneralRe: Where to put registration data? Pin
robotz24-Jul-08 22:13
robotz24-Jul-08 22:13 
Questionlogic: Find out whether a string has duplicates in a string array (pure C++,no MFC supported) Pin
NiceNaidu24-Jul-08 4:24
NiceNaidu24-Jul-08 4:24 
Hi friends,
I have an array of strings
say,
"test","test1","test2","test1" and so on....
How can i find out the string "test1" has a duplicate.
I have to list out all the strings that have duplicates.
If the array is "test","test1","test2","test1","test2","test2","test3" and so on....
Then my output should be "test1","test2".
Since the array size is not fixed , i cannot use arrays for storing the values.
I have tried several logics with vector<> ,but i could not find a solution yet.

Here i am posting the code that removes the duplicates.But I am not sure how to identify the element that has duplicates.

/*Here list already consists the the elements */
vector<string>::iterator iter = list.begin ();
vector<string>::iterator iter1 = list.end ();

//remove duplicates from the list
if (list.size () > 1)
{
for (; iter + 1 != iter1; ++iter)
{
iter1 = remove (iter + 1, iter1, *iter);
}
list.erase (iter1, list.end ());
}

Any kind of help is really appreciated.

Thanks in advance.

Appu..
"Never explain yourself to anyone.
Because the person who likes you does n't need it.
And the person who dislikes you won't believe it."
AnswerRe: logic: Find out whether a string has duplicates in a string array (pure C++,no MFC supported) Pin
David Crow24-Jul-08 4:42
David Crow24-Jul-08 4:42 
GeneralRe: logic: Find out whether a string has duplicates in a string array (pure C++,no MFC supported) Pin
NiceNaidu24-Jul-08 6:04
NiceNaidu24-Jul-08 6:04 
QuestionRe: logic: Find out whether a string has duplicates in a string array (pure C++,no MFC supported) Pin
David Crow24-Jul-08 6:05
David Crow24-Jul-08 6:05 
AnswerRe: logic: Find out whether a string has duplicates in a string array (pure C++,no MFC supported) Pin
NiceNaidu24-Jul-08 6:13
NiceNaidu24-Jul-08 6:13 
GeneralRe: logic: Find out whether a string has duplicates in a string array (pure C++,no MFC supported) Pin
David Crow24-Jul-08 6:16
David Crow24-Jul-08 6:16 
GeneralRe: logic: Find out whether a string has duplicates in a string array (pure C++,no MFC supported) Pin
NiceNaidu24-Jul-08 6:26
NiceNaidu24-Jul-08 6:26 
GeneralRe: logic: Find out whether a string has duplicates in a string array (pure C++,no MFC supported) Pin
David Crow24-Jul-08 7:39
David Crow24-Jul-08 7:39 
JokeRe: logic: Find out whether a string has duplicates in a string array (pure C++,no MFC supported) Pin
Maximilien24-Jul-08 8:22
Maximilien24-Jul-08 8:22 
GeneralRe: logic: Find out whether a string has duplicates in a string array (pure C++,no MFC supported) Pin
NiceNaidu24-Jul-08 18:59
NiceNaidu24-Jul-08 18:59 
AnswerRe: logic: Find out whether a string has duplicates in a string array (pure C++,no MFC supported) Pin
Stephen Hewitt24-Jul-08 15:19
Stephen Hewitt24-Jul-08 15:19 
GeneralRe: logic: Find out whether a string has duplicates in a string array (pure C++,no MFC supported) Pin
NiceNaidu24-Jul-08 18:55
NiceNaidu24-Jul-08 18:55 
GeneralRe: logic: Find out whether a string has duplicates in a string array (pure C++,no MFC supported) Pin
Stephen Hewitt24-Jul-08 19:02
Stephen Hewitt24-Jul-08 19:02 
GeneralRe: logic: Find out whether a string has duplicates in a string array (pure C++,no MFC supported) Pin
NiceNaidu24-Jul-08 22:56
NiceNaidu24-Jul-08 22:56 
GeneralRe: logic: Find out whether a string has duplicates in a string array (pure C++,no MFC supported) Pin
Stephen Hewitt27-Jul-08 14:08
Stephen Hewitt27-Jul-08 14:08 
GeneralRe: logic: Find out whether a string has duplicates in a string array (pure C++,no MFC supported) Pin
NiceNaidu4-Aug-08 4:40
NiceNaidu4-Aug-08 4:40 
Questionhow to use the vector in vc++.net 2005 Pin
Anamika200524-Jul-08 2:00
Anamika200524-Jul-08 2:00 
AnswerRe: how to use the vector in vc++.net 2005 Pin
Matthew Faithfull24-Jul-08 2:10
Matthew Faithfull24-Jul-08 2:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.