Здравствуйте. При компиляции возникают такие ошибки помогите их исправить.(Скрин). Сроки в которых возникают ошибки выделил черным.
Код:
#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;