Click here to Skip to main content
15,902,777 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Help solving: error C2653: 'FindUserDlg' : is not a class or namespace name Pin
Jun Du10-Jul-06 9:46
Jun Du10-Jul-06 9:46 
AnswerRe: Help solving: error C2653: 'FindUserDlg' : is not a class or namespace name Pin
RChin10-Jul-06 10:29
RChin10-Jul-06 10:29 
QuestionCreating performance counters Pin
Mike Dimmick10-Jul-06 6:49
Mike Dimmick10-Jul-06 6:49 
AnswerRe: Creating performance counters Pin
Jonathan [Darka]10-Jul-06 8:26
professionalJonathan [Darka]10-Jul-06 8:26 
AnswerRe: Creating performance counters Pin
Mike Dimmick10-Jul-06 23:41
Mike Dimmick10-Jul-06 23:41 
GeneralRe: list control Pin
FarPointer10-Jul-06 6:00
FarPointer10-Jul-06 6:00 
GeneralRe: list control Pin
jokefake10-Jul-06 6:44
jokefake10-Jul-06 6:44 
QuestionSorting a list with class for complex types [modified] Pin
Harold_Wishes10-Jul-06 5:26
Harold_Wishes10-Jul-06 5:26 
Hello

I have designed a program that takes in a list of structs of type data (shown below). The program works fine. But I need a way of sorting the list by decreasing length of string Sequence. In other words, I need to determine the length of each Sequence and position each data so that the longest strings appear first.

So I am not comparing strings themselves, but lengths of strings. I know there is a sort function that is part of the <list> class, but I am not sure if I can use it in this situation.

Thanks in advance for anyone who can come to a solution.
HRW.


#include <string>
#include <list>
#include <iostream>
#include <fstream>

using namespace std;


struct data                                             //
{
     string Length;                   //
     string Sequence;                                               //  
     string N_Terminal;                                             // 
     string C_Terminal;
};


list<data> g_DataList;
list<data>::iterator dataListIter;


-- modified at 11:29 Monday 10th July, 2006
QuestionRe: Sorting a list with class for complex types Pin
David Crow10-Jul-06 5:31
David Crow10-Jul-06 5:31 
AnswerRe: Sorting a list with class for complex types Pin
Jun Du10-Jul-06 5:35
Jun Du10-Jul-06 5:35 
AnswerRe: Sorting a list with class for complex types [modified] Pin
FarPointer10-Jul-06 6:29
FarPointer10-Jul-06 6:29 
GeneralRe: Sorting a list with class for complex types [modified] Pin
Harold_Wishes10-Jul-06 7:02
Harold_Wishes10-Jul-06 7:02 
GeneralRe: Sorting a list with class for complex types [modified] Pin
FarPointer10-Jul-06 7:28
FarPointer10-Jul-06 7:28 
QuestionRe: Sorting a list with class for complex types Pin
David Crow10-Jul-06 7:36
David Crow10-Jul-06 7:36 
AnswerRe: Sorting a list with class for complex types [modified] Pin
Harold_Wishes10-Jul-06 7:48
Harold_Wishes10-Jul-06 7:48 
GeneralRe: Sorting a list with class for complex types [modified] Pin
FarPointer10-Jul-06 7:54
FarPointer10-Jul-06 7:54 
GeneralRe: Sorting a list with class for complex types [modified] Pin
Harold_Wishes10-Jul-06 8:09
Harold_Wishes10-Jul-06 8:09 
GeneralRe: Sorting a list with class for complex types Pin
FarPointer10-Jul-06 8:18
FarPointer10-Jul-06 8:18 
GeneralRe: Sorting a list with class for complex types Pin
Harold_Wishes10-Jul-06 8:33
Harold_Wishes10-Jul-06 8:33 
GeneralRe: Sorting a list with class for complex types Pin
David Crow10-Jul-06 9:11
David Crow10-Jul-06 9:11 
GeneralRe: Sorting a list with class for complex types Pin
Zac Howland10-Jul-06 8:39
Zac Howland10-Jul-06 8:39 
GeneralRe: Sorting a list with class for complex types [modified] Pin
Harold_Wishes10-Jul-06 9:01
Harold_Wishes10-Jul-06 9:01 
GeneralRe: Sorting a list with class for complex types Pin
Zac Howland10-Jul-06 9:25
Zac Howland10-Jul-06 9:25 
GeneralRe: Sorting a list with class for complex types Pin
David Crow10-Jul-06 8:18
David Crow10-Jul-06 8:18 
GeneralRe: Sorting a list with class for complex types Pin
FarPointer10-Jul-06 8:26
FarPointer10-Jul-06 8:26 

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.