Click here to Skip to main content
15,913,361 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Looping when you need user input Pin
Code-o-mat7-May-12 4:03
Code-o-mat7-May-12 4:03 
GeneralWelcome Pin
Code-o-mat5-May-12 23:11
Code-o-mat5-May-12 23:11 
Question64 bit problem Pin
appollosputnik4-May-12 4:41
appollosputnik4-May-12 4:41 
AnswerRe: 64 bit problem Pin
Albert Holguin4-May-12 9:58
professionalAlbert Holguin4-May-12 9:58 
AnswerRe: 64 bit problem Pin
«_Superman_»4-May-12 16:43
professional«_Superman_»4-May-12 16:43 
QuestionHelp for algorithm Pin
Falconapollo3-May-12 23:53
Falconapollo3-May-12 23:53 
QuestionRe: Help for algorithm Pin
Maximilien4-May-12 2:38
Maximilien4-May-12 2:38 
AnswerRe: Help for algorithm Pin
«_Superman_»4-May-12 3:15
professional«_Superman_»4-May-12 3:15 
It could be something as shown below -
C#
bool GetSecond(const string& first, string& second)
{
    for (int i = 0; i < ARR_SIZE; ++i)
    {
        if (first == arr[i].first)
        {
            second = arr[i].second;
            return true;
        }
    }

    return false;
}

void GetDest(const string& src, string& dest)
{
    string src2 = src;

    while (GetSecond(src2, dest))
    {
        if (src == dest)
            break;

        src2 = dest;
    }
}

For each element in the pair call GetDest with first as the first parameter and second as the second parameter.
You may need to add other conditions to satisfy your algorithm.
«_Superman 
I love work. It gives me something to do between weekends.


Microsoft MVP (Visual C++)

Polymorphism in C

GeneralRe: Help for algorithm Pin
Falconapollo5-May-12 20:12
Falconapollo5-May-12 20:12 
AnswerRe: Help for algorithm Pin
Albert Holguin4-May-12 10:12
professionalAlbert Holguin4-May-12 10:12 
GeneralRe: Help for algorithm Pin
Falconapollo5-May-12 20:29
Falconapollo5-May-12 20:29 
QuestionRe: Help for algorithm Pin
CPallini4-May-12 10:47
mveCPallini4-May-12 10:47 
AnswerRe: Help for algorithm Pin
Falconapollo5-May-12 20:37
Falconapollo5-May-12 20:37 
QuestionRe: Help for algorithm Pin
CPallini6-May-12 22:42
mveCPallini6-May-12 22:42 
AnswerRe: Help for algorithm Pin
Falconapollo8-May-12 19:30
Falconapollo8-May-12 19:30 
AnswerRe: Help for algorithm Pin
Philippe Mori5-May-12 1:55
Philippe Mori5-May-12 1:55 
GeneralRe: Help for algorithm Pin
Falconapollo5-May-12 20:41
Falconapollo5-May-12 20:41 
GeneralRe: Help for algorithm Pin
Philippe Mori6-May-12 2:12
Philippe Mori6-May-12 2:12 
QuestionSOLVED Project cannot be build. Two cpp files configured to produce pch error. Pin
Vaclav_3-May-12 4:45
Vaclav_3-May-12 4:45 
AnswerRe: Project cannot be build. Two cpp files configured to produce pch error. Pin
Richard MacCutchan3-May-12 6:47
mveRichard MacCutchan3-May-12 6:47 
GeneralRe: Project cannot be build. Two cpp files configured to produce pch error. Pin
Vaclav_3-May-12 8:02
Vaclav_3-May-12 8:02 
GeneralRe: Project cannot be build. Two cpp files configured to produce pch error. Pin
Richard MacCutchan3-May-12 8:10
mveRichard MacCutchan3-May-12 8:10 
GeneralRe: Project cannot be build. Two cpp files configured to produce pch error. Pin
Vaclav_3-May-12 8:36
Vaclav_3-May-12 8:36 
GeneralRe: Project cannot be build. Two cpp files configured to produce pch error. Pin
Vaclav_3-May-12 8:58
Vaclav_3-May-12 8:58 
GeneralRe: Project cannot be build. Two cpp files configured to produce pch error. Pin
Richard MacCutchan3-May-12 9:55
mveRichard MacCutchan3-May-12 9:55 

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.