QT ошибка: cannot initialize a variable of type 'node *' with an rvalue of type 'int'

269
15 ноября 2017, 01:27

Исходник:

void MainWindow::Search()
{
    node* Active = NewTree.Delete(ui->textEdit->toPlainText().toInt(),     &NewTree.Tree);
    myPicture->DrawEl(Active->Key, Active->X, Active->Y, bool color);
}

Структура:

struct node
 {
    int Key;
    int Count;
    node *Left;
    node *Right;
    int X, Y;
 };

Ошибки:

/laba2/mainwindow.cpp:73: ошибка: cannot initialize a variable of type 'node*' with an rvalue of type 'int' divv* Active = NewTree.Delete(ui->textEdit->toPlainText().toInt(), &NewTree.Tree);

/laba2/mainwindow.cpp:74: ошибка: expected '(' for function-style cast or type construction myPicture->DrawEl(Active->Key, Active->X, Active->Y, bool color);

int TREE::Delete (int el, node **w)
{
    node** tempAdr = NULL;
node* tempVal = NULL;
tempAdr = &*w;
tempVal = *w;
    if  (w==NULL)
    {// Вершины в дереве нет;
        cout << "Такой вершины нет";
        return -1; }
    else
    {
        if  (el<(**w).Key)
        {
            Delete (el, &((**w).Left));
            return 1;
        }
        else
        {
            if  (el>(**w).Key)
            {
                Delete (el,&((**w).Right));
                return 1;
            }
        }
    }
if (tempVal->Right == NULL)
    *tempAdr = tempVal->Left;
else
{ node *y = tempVal->Right;
    if (y ->Left == NULL)
    {
        y->Left = tempVal->Left;
        *tempAdr = y;
    }
    else
    {
        node *x = y->Left;
        while (x->Left != NULL)
        {
            y=x;
            x=y->Left;
        }
        y->Left = x->Right;
        x->Left = tempVal->Left;
        x->Right = tempVal->Right;
        *tempAdr = x;
    }
}
return 1;
}

Ругается постоянно, всё перепробовал

READ ALSO
Помощь с указателями

Помощь с указателями

Всем привет, дошел до темы указателей, честно говоря, тема неприятная, поэтому сразу к вам вопросы, товарищи

238
Расчет RECT занимаемый текстом

Расчет RECT занимаемый текстом

Использую библиотеку dwrite для рендера текста в Direct2DТекст хорошо рисуется, проблем никаких нет

191
Подключение сторонних файлов в Qt creator

Подключение сторонних файлов в Qt creator

Можно ли подключить в Qt creatorh файлы,написанные на c++ в vs2015,и использовать их функционал?

263
Обход пробела в строке

Обход пробела в строке

Вот код сбственно

266