структуры данных — Сравнение узлов-членов семейства в переполнении стека

Я работаю над списком единой семьи. Мне казалось, что я не могу сравнить члена семьи.

Узел состоит из следующего:

class Node{
public:
int id, age;
string name;
char sex;
string father, mother;

Node* next;
};

Реализация кода:

Node* currNode = head;
Node* prevNode = NULL;
int index = 1;

//while the current node and the current nodes name is not string one
//n1 and n2 are strings
while(currNode && currNode->name != n1 && prevNode && prevNode->name !=n2){
prevNode = currNode;
currNode = currNode->next;
index++;
}if(currNode->father == prevNode->name){
cout<<prevNode->name<<" is the father"<<endl;
}

0

Решение

Задача ещё не решена.

Другие решения


По вопросам рекламы ammmcru@yandex.ru
Adblock
detector