Форум программистов
 

Восстановите пароль или Зарегистрируйтесь на форуме, о проблемах и с заказом рекламы пишите сюда - alarforum@yandex.ru, проверяйте папку спам!

Вернуться   Форум программистов > C/C++ программирование > Общие вопросы C/C++
Регистрация

Восстановить пароль
Повторная активизация e-mail

Купить рекламу на форуме - 42 тыс руб за месяц

Ответ
 
Опции темы Поиск в этой теме
Старый 11.05.2016, 19:52   #1
Keniro
Пользователь
 
Регистрация: 27.09.2015
Сообщений: 21
Вопрос Ошибки при компиляци C++

Здравствуйте. При компиляции возникают такие ошибки помогите их исправить.(Скрин). Сроки в которых возникают ошибки выделил черным.
Код:
#include "Trial.h"
#include <iostream>
using namespace std;
struct List_of_Trial
{
    Trial object;
    List_of_Trial *next;
};
#pragma once
class Group_of_Trial
{
public:
    List_of_Trial *begin;
    Group_of_Trial()
    {
        begin = NULL;
    }
    void add_to_begin(Trial obj);
    void add_to_end(Trial obj);
    void add_by_position(Trial obj, int pos);
    void Delete_by_position(int pos);
    void show_list();
    void Trial();
};
void Group_of_Trial::add_to_begin(Trial obj)
{
    List_of_Trial *newelem = new List_of_Trial;
    newelem->object = obj;
    newelem->next = begin;//  newelem->next = NULL
                          //  while(first != 0) newelem->next = first;
    begin = newelem;
}
 
void Group_of_Trial::add_to_end(Trial obj)
{
    List_of_Trial *current;
    current = begin;
    while (current->next != 0)
    {
        current = current->next;
    }
    List_of_Trial *newelem = new List_of_Trial;
    newelem->object = obj;
    newelem->next = NULL;
    current->next = newelem;
}
void Group_of_Trial::add_by_position(Trial obj, int pos)
{
    List_of_Trial*newelem = new List_of_Trial;
    newelem->object = obj;
    newelem->next = NULL;
    if (    pos == 1 )// when the list is empty 
    {
        newelem->next = newelem;
        begin = newelem;
        return;
    }
    List_of_Trial *temp = begin;
    for (int i(0); i<pos-2; i++)
    {
        temp = temp->next;
    }
    newelem->next = temp->next;
    temp->next = newelem;
 
 
}
void Group_of_Trial::show_list()
{
    if (begin == 0)
    {
        cout << "\n  The list is empty, create new objects please." << endl;
    }
    List_of_Trial *current;
    current = begin;
    while (current)
    {
        current->object.Show();
        current = current->next;
    }
}
void Group_of_Trial::Trial()
{
    
    cout <<"\n  Enter Trial(name) to find Plants: "<<endl;
    cout << "\n  ";
    string tr;// = "Metalurgy";
    cin.get();
    getline(cin,tr);
    if (begin == 0)
    {
        cout << "\n  The list is empty, create new objects please." << endl;
    }
    List_of_Trial *temp = begin;
    //cout << "\n\n\n  So, the best insuranse companies with over then "<<pay<<"$ peyments are : \n\n\n";
    while (temp != 0)
    {
        if(temp->object.get_trial() == tr  )
        {
            temp->object.Show();
        }
        temp = temp->next;
    }
    //
    //List_of_INS_COMP *current;
    //current = begin;
    //int MAX = 0;
    //while(current)
    //{
    //  if(MAX < current->object.Get_payment())
    //  {
    //      MAX = current->object.Get_payment();
    //      current->next->object.Show();
    //  /*cout << current->object.Get_emp()<<"\n";
    //      cout << current->object.Get_sal()<<"\n";
    //      cout << current->object.Get_payment()<<"\n\n\n"*/;
    //  }
    //  current = current->next;
    //}
 
    //
    //cout <<" has the biggest amout of payment per year :"<< MAX<<"$"; 
}
void Group_of_Trial::Delete_by_position(int pos)
{
    if (begin == 0)
    {
        cout << "\n  The list is empty, create new objects please." << endl;
        return;
    }
    // deletes node in position pos
    List_of_Trial *current = begin;
    if ( pos == 1)
    {
        begin = current->next;// first will point to  the second node
        delete current;
        return;
    }
    for(int i(0); i< pos-2; i++)
    {
        current = current->next;
        // current points to n - 1 node in list
    }
    List_of_Trial *newelem = current->next;// nth node
    current->next = newelem->next;// (n+1)nth node  
    delete newelem;
Изображения
Тип файла: jpg Screenshot_3.jpg (11.8 Кб, 116 просмотров)
Keniro вне форума Ответить с цитированием
Ответ


Купить рекламу на форуме - 42 тыс руб за месяц



Похожие темы
Тема Автор Раздел Ответов Последнее сообщение
Ошибки при отладке fygas1991 C# (си шарп) 3 08.01.2015 15:10
Ошибки при компилировании yurets17 Помощь студентам 1 17.02.2014 17:29
ошибки при компиляции Lers Assembler - Ассемблер (FASM, MASM, WASM, NASM, GoASM, Gas, RosAsm, HLA) и не рекомендуем TASM 0 05.06.2013 21:25
Ошибки при построении yugik Visual C++ 7 27.08.2010 17:58
Ошибки при сохранении Alex19789 Microsoft Office Excel 6 16.10.2009 12:39