Эффективность множественного наследования - Курсовая работа

бесплатно 0
4.5 80
Реализация множественного наследования в области учета транспортных средств. Принцип работы приложения в текстовой форме, его структура. Таблица свойств объектов и идентификаторов. UML-диаграмма. Описание программы на примере с представлением экранных.


Аннотация к работе
1.Задание на курсовую работу: реализовать множественное наследование на выбранной предметной области (учет транспортных средств). Постановка задачи: - Круг пользователей приложения: данное приложение создано в соответствии с заданием учебного плана, пользователями являются только исполнитель и заказчик. Информация, вводимая пользователем приложения: Информация о транспортном средстве (далее - ТС): - название ТС Label NUMBERLABEL Text:Рег. знак: NAMELABEL Text:Название ТС: YEARLABEL Text:Год выпуска: DRIVERLABEL Text:Водитель: label1 Text:Тип ТС MASSLABEL Text:Масса: ENGINECAPACITYLABEL Text:Расход топлива: LOADCAPACITYLABEL Text:Грузоподъемность: PASSENGERCAPACITYLABEL Text:Колво пассажиров: MAXIMUMSPEEDLABEL Text:Максимальная скорость: CLEARANCELABEL Text:Клиренс: WATERDISPLACEMENTLABEL Text:Водоизмещение: WAVESIZELABEL Text:Допустимый размер волн: WATERMAXSPEEDLABEL Text:Макс.

Список литературы
1. Журнал для профессионалов. Программирование на С/С , 2008, №1, 2008, №2

2. Базы данных. Вводный курс. 11.2.3 Связи - обобщения и механизмы наследования классов. http://citforum.ru/database/advanced_intro/31.shtml

3. Правило 40: Продумывайте подход к использованию множественного наследования. http://www.e-reading-lib.org/chapter.php/1002058/101/Mayers_-_Effektivnoe_ispolzovanie_CPP.html

Приложение исходный код программы с комментариями

LISTFORM.h

VOIDUPDATEVEHICLELISTVIEW()

{

VEHICLELISTVIEW->Items->Clear();

VEHICLELIST *obj = vehicles;

while (obj != NULL)

{

VEHICLELISTVIEW->Items->Add(CHARTOSYSSTRING(obj->v->name));

System::String ^VTYPE;

if (obj->v->CLASS_ID == LAND_VEHICLE_ID) VTYPE = LAND_VEHICLE_NAME;

if (obj->v->CLASS_ID == WATER_VEHICLE_ID) VTYPE = WATER_VEHICLE_NAME;

if (obj->v->CLASS_ID == AMPHIBIAN_VEHICLE_ID) VTYPE = AMPHIBIAN_VEHICLE_NAME;

VEHICLELISTVIEW->Items[VEHICLELISTVIEW->Items->Count-1]->SUBITEMS->Add(VTYPE);

VEHICLELISTVIEW->Items[VEHICLELISTVIEW->Items->Count-1]->SUBITEMS->Add(CHARTOSYSSTRING(obj->v->number));

VEHICLELISTVIEW->Items[VEHICLELISTVIEW->Items->Count-1]->SUBITEMS->Add(CHARTOSYSSTRING(obj->v->driver));

if (obj->v->in_use) VTYPE = "Да";

ELSEVTYPE = "Нет";

VEHICLELISTVIEW->Items[VEHICLELISTVIEW->Items->Count-1]->SUBITEMS->Add(VTYPE);

obj = obj->next;

}

} private: System::Void ADBUTTON_Click(System::Object^ sender, System::EVENTARGS^ e)

{ edit_form->EDITMODE = false;

edit_form->DISABLEFORMCOMPONENTS();

edit_form->SETFORMCOMPONENTS();

edit_form->SHOWDIALOG();

UPDATEVEHICLELISTVIEW();

} private: System::Void СПРАВКАTOOLSTRIPMENUITEM_Click(System::Object^ sender, System::EVENTARGS^ e)

{ help_form->SHOWDIALOG();} private: System::Void EDITBUTTON_Click(System::Object^ sender, System::EVENTARGS^ e)

{ if ( VEHICLELISTVIEW->SELECTEDITEMS->Count == 0 ) return;

VEHICLELIST *vl = vehicles;

vehicle *v = NULL;

while(vl != NULL )

{ if (strcmp(vl->v->name,SYSSTRINGTOCHAR(VEHICLELISTVIEW->Items[VEHICLELISTVIEW->SELECTEDINDICES[0]]->Text)) == 0)

{ v = vl->v;

} vl = vl->next;

} if (v == NULL) return;

edit_form->DISABLEFORMCOMPONENTS();

edit_form->DATAFROMVEHICLE(v);

edit_form->EDITMODE = true;

edit_form->EDITVEHICLE = VEHICLELISTVIEW->Items[VEHICLELISTVIEW->SELECTEDINDICES[0]]->Text;

edit_form->SETFORMCOMPONENTS();

edit_form->SHOWDIALOG();

UPDATEVEHICLELISTVIEW(); } private: System::Void button1_Click(System::Object^ sender, System::EVENTARGS^ e)

{ if ( VEHICLELISTVIEW->SELECTEDITEMS->Count == 0 ) return;

vehicles = DELETEVEHICLE(vehicles,SYSSTRINGTOCHAR(VEHICLELISTVIEW->Items[VEHICLELISTVIEW->SELECTEDINDICES[0]]->Text));

UPDATEVEHICLELISTVIEW();

} private: System::Void LISTFORM_FORMCLOSED(System::Object^ sender, System::Windows::Forms::FORMCLOSEDEVENTARGS^ e)

{ vehicles = DELETEVEHICLES(vehicles);

} private: System::Void ОЧИСТИТЬTOOLSTRIPMENUITEM_Click(System::Object^ sender, System::EVENTARGS^ e)

{ vehicles = DELETEVEHICLES(vehicles);

UPDATEVEHICLELISTVIEW();

} private: System::Void СОХРАНИТЬTOOLSTRIPMENUITEM_Click(System::Object^ sender, System::EVENTARGS^ e)

{ if ((this->SAVEFILEDIALOG->SHOWDIALOG() == System::Windows::Forms::DIALOGRESULT::OK) && (this->SAVEFILEDIALOG->FILENAME->Length > 0 ))

{ char *path = SYSSTRINGTOCHAR(this->SAVEFILEDIALOG->FILENAME);

ofstream out(path,ios::binary);

if (out == NULL)

{

MESSAGEBOX::Show("Невозможно открыть файл для записи!.","Ошибка!.");this->Close();

} intcount = VEHICLELISTVIEW->Items->Count;out.write((char*)&count,sizeof(int));

VEHICLELIST *vl = vehicles;

while ( vl != NULL)

{ vl->v->WRITETOSTREAM( out );

vl = vl->next;

} out.close();

}

} private: System::Void ЗАГРУЗИЬTOOLSTRIPMENUITEM_Click(System::Object^ sender, System::EVENTARGS^ e)

{ if ((this->OPENFILEDIALOG->SHOWDIALOG() == System::Windows::Forms::DIALOGRESULT::OK) && (this->OPENFILEDIALOG->FILENAME->Length > 0 ))

{ vehicles = DELETEVEHICLES(vehicles);

UPDATEVEHICLELISTVIEW();

char *path = SYSSTRINGTOCHAR(this->OPENFILEDIALOG->FILENAME);

ifstream in(path,ios::binary);

if (in == NULL)

{

MESSAGEBOX::Show("Невозможно открыть файл для чтения!.","Ошибка!.");

this->Close();

}

INTVEHICLECOUNT=0;

in.read((char*)&VEHICLECOUNT,sizeof(int));

for (int i=0;i<VEHICLECOUNT;i )

{ int CLASS_ID;

in.read((char*)&CLASS_ID,sizeof(int));

if (CLASS_ID == LAND_VEHICLE_ID)

{ land_vehicle *v = newland_vehicle("");

v->READFROMSTREAM( in );

vehicles = ADDVEHICLE(vehicles,v);

} if (CLASS_ID == WATER_VEHICLE_ID)

{ water_vehicle *v = newwater_vehicle("");

v->READFROMSTREAM( in );

vehicles = ADDVEHICLE(vehicles,v);

} if (CLASS_ID == AMPHIBIAN_VEHICLE_ID)

{ amphibian_vehicle *v = newamphibian_vehicle("");

v->READFROMSTREAM( in );

vehicles = ADDVEHICLE(vehicles,v);

}

} in.close();

UPDATEVEHICLELISTVIEW();

}

}

};

EDITFORM.h

VOIDDISABLEFORMCOMPONENTS()

{ this->GROUPBOX1->Enabled = false;

this->GROUPBOX2->Enabled = false;

this->ADDBUTTON->Enabled = false;

this->WATERMAXSPEEDBOX->Enabled = false;

this->WATERMAXSPEEDLABEL->Enabled = false;

this->CLEARANCELABEL->Enabled = false;

this->CLEARANCEBOX->Enabled = false;

this->TYPECOMBOBOX->Enabled = true;

this->NAMEBOX->Clear();

this->ENGINECAPACITYBOX->Text = "0";

this->LOADCAPACITYBOX->Text = "0";

this->MASSBOX->Text = "0";

this->MAXIMUMSPEEDBOX->Text = "0";

this->PASSENGERCAPACITYBOX->Text = "0";

this->CLEARANCEBOX->Text = "0";

this->WATERDISPLACEMENTBOX->Text = "0";

this->WAVESIZEBOX->Text = "0";

this->WATERMAXSPEEDBOX->Text = "0";

this->NUMBERBOX->Clear();

this->DRIVERBOX->Clear();

this->YEARBOX->Clear();

this->USECHECKBOX->Checked = false;

}

VOIDSETFORMCOMPONENTS()

{ if (this->EDITMODE) this->TYPECOMBOBOX->Enabled = false;

if (this->TYPECOMBOBOX->SELECTEDINDEX == LAND_VEHICLE_ID)

{ this->GROUPBOX1->Enabled = true;

this->GROUPBOX2->Enabled = false;

this->WATERMAXSPEEDBOX->Enabled = false;

this->WATERMAXSPEEDLABEL->Enabled = false;

this->CLEARANCELABEL->Enabled = true;

this->CLEARANCEBOX->Enabled = true;

} if (this->TYPECOMBOBOX->SELECTEDINDEX == WATER_VEHICLE_ID)

{ this->GROUPBOX1->Enabled = true;

this->GROUPBOX2->Enabled = true;

this->WATERMAXSPEEDBOX->Enabled = false;

this->WATERMAXSPEEDLABEL->Enabled = false;

this->CLEARANCELABEL->Enabled = false;

this->CLEARANCEBOX->Enabled = false;

} if (this->TYPECOMBOBOX->SELECTEDINDEX == AMPHIBIAN_VEHICLE_ID)

{ this->GROUPBOX1->Enabled = true;

this->GROUPBOX2->Enabled = true;

this->WATERMAXSPEEDBOX->Enabled = true;

this->WATERMAXSPEEDLABEL->Enabled = true;

this->CLEARANCELABEL->Enabled = true;

this->CLEARANCEBOX->Enabled = true;

} this->ADDBUTTON->Enabled = true;

}

BOOLDATATOVEHICLE( vehicle *v )

{

System::String ^number,^driver,^name;

inty,ec,lc,m,ms,pc,rc,wd,wa,mws;

try

{ number = this->NUMBERBOX->Text;

driver = this->DRIVERBOX->Text;

name = this->NAMEBOX->Text;

y = System::Convert::TOINT32(this->YEARBOX->Text);

ec = System::Convert::TOINT32(this->ENGINECAPACITYBOX->Text);

lc = System::Convert::TOINT32(this->LOADCAPACITYBOX->Text);

m = System::Convert::TOINT32(this->MASSBOX->Text);

ms = System::Convert::TOINT32(this->MAXIMUMSPEEDBOX->Text);

pc = System::Convert::TOINT32(this->PASSENGERCAPACITYBOX->Text);

if (v->CLASS_ID == LAND_VEHICLE_ID)

{ rc = System::Convert::TOINT32(this->CLEARANCEBOX->Text);

} if (v->CLASS_ID == WATER_VEHICLE_ID)

{ wd = System::Convert::TOINT32(this->WATERDISPLACEMENTBOX->Text);

wa = System::Convert::TOINT32(this->WAVESIZEBOX->Text);

} if (v->CLASS_ID == AMPHIBIAN_VEHICLE_ID)

{ rc = System::Convert::TOINT32(this->CLEARANCEBOX->Text);

wd = System::Convert::TOINT32(this->WATERDISPLACEMENTBOX->Text);

wa = System::Convert::TOINT32(this->WAVESIZEBOX->Text);

mws = System::Convert::TOINT32(this->WATERMAXSPEEDBOX->Text);

}

} catch (...)

{

MESSAGEBOX::Show("Введите корректные значения во все поля!","Ошибка.");

returnfalse;

} if ( name == "")

{

MESSAGEBOX::Show("ВВЕДИТЕНАЗВАНИЕТС!","Ошибка.");

returnfalse;

}

VEHICLELIST *vl = vehicles;

while (vl != NULL)

{ if (vl->v != v) if (strcmp(vl->v->name,SYSSTRINGTOCHAR(name))== 0)

{

MESSAGEBOX::Show("ТС с таким именем уже существует!","Ошибка.");

returnfalse;

} vl = vl->next;

} v->driver = SYSSTRINGTOCHAR(driver);

v->number = SYSSTRINGTOCHAR(number);

v->year = y;

v->in_use = this->USECHECKBOX->Checked;

v->engine_capacity = ec;

v->load_capacity = lc;

v->mass = m;

v->max_speed = ms;

v->name = SYSSTRINGTOCHAR(name);

v->passenger_capacity = pc;

if (v->CLASS_ID == LAND_VEHICLE_ID)

{ land_vehicle *vl = (land_vehicle*) v;

vl->road_clearance = rc;

} if (v->CLASS_ID == WATER_VEHICLE_ID)

{ water_vehicle *vw = (water_vehicle*) v;

vw->water_displacement = wd;

vw->waves_allowable_size = wa;

} if (v->CLASS_ID == AMPHIBIAN_VEHICLE_ID)

{ amphibian_vehicle *va = (amphibian_vehicle*) v;

va->road_clearance = rc;

va->water_displacement = wd;

va->waves_allowable_size = wa;

va->max_water_speed = mws;

} returntrue;

}

VOIDDATAFROMVEHICLE( vehicle *v )

{ this->NUMBERBOX->Text = CHARTOSYSSTRING(v->number);

this->DRIVERBOX->Text = CHARTOSYSSTRING(v->driver);

this->YEARBOX->Text = v->year.TOSTRING();

this->USECHECKBOX->Checked = v->in_use;

this->NAMEBOX->Text = CHARTOSYSSTRING(v->name);

this->TYPECOMBOBOX->SELECTEDINDEX = v->CLASS_ID;

this->ENGINECAPACITYBOX->Text = v->engine_capacity.TOSTRING();

this->LOADCAPACITYBOX->Text = v->load_capacity.TOSTRING();

this->MASSBOX->Text = v->mass.TOSTRING();

MAXIMUMSPEEDBOX->Text = v->max_speed.TOSTRING();

this->PASSENGERCAPACITYBOX->Text = v->passenger_capacity.TOSTRING();

if (v->CLASS_ID == LAND_VEHICLE_ID)

{ land_vehicle *vl = (land_vehicle*) v;

this->CLEARANCEBOX->Text = vl->road_clearance.TOSTRING();

} if (v->CLASS_ID == WATER_VEHICLE_ID)

{ water_vehicle *vw = (water_vehicle*) v;

this->WATERDISPLACEMENTBOX->Text = vw->water_displacement.TOSTRING();

this->WAVESIZEBOX->Text = vw->waves_allowable_size.TOSTRING();

} if (v->CLASS_ID == AMPHIBIAN_VEHICLE_ID)

{ amphibian_vehicle *va = (amphibian_vehicle*) v;

this->CLEARANCEBOX->Text = va->road_clearance.TOSTRING();

this->WATERDISPLACEMENTBOX->Text = va->water_displacement.TOSTRING();

this->WAVESIZEBOX->Text = va->waves_allowable_size.TOSTRING();

this->WATERMAXSPEEDBOX->Text = va->max_water_speed.TOSTRING();

}

} private: System::Void EDITFORM_Shown(System::Object^ sender, System::EVENTARGS^ e)

{

} private: System::Void TYPECOMBOBOX_SELECTEDINDEXCHANGED(System::Object^ sender, System::EVENTARGS^ e)

{

SETFORMCOMPONENTS();

} private: System::Void ADDBUTTON_Click(System::Object^ sender, System::EVENTARGS^ e)

{ if (this->EDITMODE)

{

VEHICLELIST *vl = vehicles;

vehicle *v;

while (vl != NULL)

{ if (strcmp(vl->v->name,SYSSTRINGTOCHAR(this->EDITVEHICLE))== 0) v = vl->v;

vl = vl->next;

} if (DATATOVEHICLE(v) == false) return;

this->Close();

} else

{ char *name = SYSSTRINGTOCHAR(this->NAMEBOX->Text);

vehicle *v;

if (this->TYPECOMBOBOX->SELECTEDINDEX == LAND_VEHICLE_ID)

{ v = newland_vehicle(name);

} if (this->TYPECOMBOBOX->SELECTEDINDEX == WATER_VEHICLE_ID)

{ v = newwater_vehicle(name);

} if (this->TYPECOMBOBOX->SELECTEDINDEX == AMPHIBIAN_VEHICLE_ID)

{ v = newamphibian_vehicle(name);

} if (DATATOVEHICLE(v) == false)

{ delete v;

return;

} vehicles = ADDVEHICLE(vehicles,v);

this->Close();

}

} private: System::Void CANCELBUTTON_Click(System::Object^ sender, System::EVENTARGS^ e)

{ this->Close();

} private: System::Void label4_Click(System::Object^ sender, System::EVENTARGS^ e) {

}

};

}

Class Vehicle classvehicle

{ public: char *number, *driver;

int year;

boolin_use;

char *name;

int mass;

intload_capacity;

intengine_capacity;

intpassenger_capacity;

intmax_speed;

int CLASS_ID;

virtual ~vehicle()=0;

VIRTUALVOIDWRITETOSTREAM( ofstream&stream );

VOIDREADFROMSTREAM( ifstream&stream );

};

classland_params

{ public: introad_clearance;

virtual ~land_params();

VOIDWRITETOSTREAM( ofstream&stream );

VOIDREADFROMSTREAM( ifstream&stream );

};

classwater_params

{ public: intwater_displacement;

intwaves_allowable_size;

virtual ~water_params() = 0;

VOIDWRITETOSTREAM( ofstream&stream );

VOIDREADFROMSTREAM( ifstream&stream );

};

classland_vehicle: public vehicle, publicland_params

{ public: land_vehicle(char *_name );

~land_vehicle();

VOIDWRITETOSTREAM( ofstream&stream );

VOIDREADFROMSTREAM( ifstream&stream );

};

classwater_vehicle: public vehicle, publicwater_params

{ public: water_vehicle(char *_name );

~water_vehicle();

VOIDWRITETOSTREAM( ofstream&stream );

VOIDREADFROMSTREAM( ifstream&stream );

};

classamphibian_vehicle: public vehicle, publicland_params, publicwater_params

{ public: intmax_water_speed;

amphibian_vehicle(char *_name );

~amphibian_vehicle();

VOIDWRITETOSTREAM( ofstream&stream );

VOIDREADFROMSTREAM( ifstream&stream );

};

STRUCTVEHICLELIST

{ vehicle *v;

VEHICLELIST*next;

};

EXTERNVEHICLELIST *vehicles;

VEHICLELIST* ADDVEHICLE(VEHICLELIST *first, vehicle *_v);

VEHICLELIST* DELETEVEHICLE(VEHICLELIST *first, char *_name);

VEHICLELIST* DELETEVEHICLES(VEHICLELIST *first );

voidwrite_string( ofstream&stream, char *str);

char* read_string( ifstream&stream);

char* SYSSTRINGTOCHAR(System::String^ string);

System::String^ CHARTOSYSSTRING(char* ch);

VEHICLECLASSES.cpp

#include "stdafx.h"

#include "VEHICLECLASSES.h" using namespace std;

VEHICLELIST *vehicles = 0;

vehicle::~vehicle() {} void vehicle::WRITETOSTREAM( ofstream &stream )

{ write_string( stream, name );

write_string( stream, driver );

write_string( stream, number );

stream.write((char*)&year,sizeof(int));

stream.write((char*)&in_use,sizeof(bool));

stream.write((char*)&mass,sizeof(int));

stream.write((char*)&passenger_capacity,sizeof(int));

stream.write((char*)&load_capacity,sizeof(int));

stream.write((char*)&engine_capacity,sizeof(int));

stream.write((char*)&max_speed,sizeof(int));

} void vehicle::READFROMSTREAM( ifstream &stream )

{ name = read_string( stream );

driver = read_string( stream );

number = read_string( stream );

stream.read((char*)&year,sizeof(int));

stream.read((char*)&in_use,sizeof(bool));

stream.read((char*)&mass,sizeof(int));

stream.read((char*)&passenger_capacity,sizeof(int));

stream.read((char*)&load_capacity,sizeof(int));

stream.read((char*)&engine_capacity,sizeof(int));

stream.read((char*)&max_speed,sizeof(int));

} land_params::~land_params() {} void land_params::WRITETOSTREAM( ofstream &stream )

{ stream.write((char*)&road_clearance,sizeof(int));

} void land_params::READFROMSTREAM( ifstream &stream )

{ stream.read((char*)&road_clearance,sizeof(int));

} water_params::~water_params() {} void water_params::WRITETOSTREAM( ofstream &stream )

{ stream.write((char*)&water_displacement,sizeof(int));

stream.write((char*)&waves_allowable_size,sizeof(int));

} void water_params::READFROMSTREAM( ifstream &stream )

{ stream.read((char*)&water_displacement,sizeof(int));

stream.read((char*)&waves_allowable_size,sizeof(int));

} land_vehicle::land_vehicle( char *_name )

{ name = _name;

CLASS_ID = LAND_VEHICLE_ID;

} land_vehicle::~land_vehicle() {} void land_vehicle::WRITETOSTREAM( ofstream &stream )

{ stream.write((char*)&CLASS_ID,sizeof(int));

vehicle::WRITETOSTREAM( stream );

land_params::WRITETOSTREAM( stream );

} void land_vehicle::READFROMSTREAM( ifstream &stream )

{ vehicle::READFROMSTREAM( stream );

land_params::READFROMSTREAM( stream );

} water_vehicle::water_vehicle( char *_name )

{ vehicle::name = _name;

CLASS_ID = WATER_VEHICLE_ID;

} water_vehicle::~water_vehicle() {} void water_vehicle::WRITETOSTREAM( ofstream &stream )

{ stream.write((char*)&CLASS_ID,sizeof(int));

vehicle::WRITETOSTREAM( stream );

water_params::WRITETOSTREAM( stream );

} void water_vehicle::READFROMSTREAM( ifstream &stream )

{ vehicle::READFROMSTREAM( stream );

water_params::READFROMSTREAM( stream );

} amphibian_vehicle::amphibian_vehicle( char *_name )

{ name = _name;

CLASS_ID = AMPHIBIAN_VEHICLE_ID;

} amphibian_vehicle::~amphibian_vehicle(){} void amphibian_vehicle::WRITETOSTREAM( ofstream &stream )

{ stream.write((char*)&CLASS_ID,sizeof(int));

vehicle::WRITETOSTREAM( stream );

land_params::WRITETOSTREAM( stream );

water_params::WRITETOSTREAM( stream );

stream.write((char*)&max_water_speed,sizeof(int));

} void amphibian_vehicle::READFROMSTREAM( ifstream &stream )

{ vehicle::READFROMSTREAM( stream );

land_params::READFROMSTREAM( stream );

water_params::READFROMSTREAM( stream );

stream.read((char*)&max_water_speed,sizeof(int));

}

VEHICLELIST* ADDVEHICLE(VEHICLELIST *first, vehicle *_v)

{

VEHICLELIST *Obj = new VEHICLELIST();

Obj->next = NULL;

Obj->v= _v;

if (first != NULL)

{

VEHICLELIST *tmp = first;

while (tmp->next != NULL) tmp = tmp->next;

tmp->next = Obj;

} if (first != NULL) return first;

else return Obj;

}

VEHICLELIST* DELETEVEHICLE(VEHICLELIST *first, char *_name)

{ if ( strcmp(first->v->name,_name) == 0 )

{

VEHICLELIST *NEWFIRST = first->next;

delete first->v;

delete first;

return NEWFIRST;

}

VEHICLELIST *Prev = first;

VEHICLELIST *Current = first->next;

while (Current != NULL)

{ if ( strcmp(Current->v->name,_name) == 0 )

{ delete Current->v;

if (Current->next != NULL)

Prev->next = Current->next;

else

Prev->next = NULL;

delete Current;

return first;

}

Prev = Prev->next;

Current = Current ->next;

} return first;

}

VEHICLELIST* DELETEVEHICLES( VEHICLELIST *first )

{

VEHICLELIST *del = first;

while (del != NULL)

{ del = DELETEVEHICLE(del,del->v->name);

} return NULL;

} using namespace System::Runtime::INTEROPSERVICES;

void write_string( ofstream &stream, char *str)

{ int size = strlen(str);

stream.write((char*)&size,sizeof(int));

stream.write(str, sizeof(char)*size);

} char* read_string( ifstream &stream)

{ int size = 0;

stream.read((char*)&size,sizeof(int));

char *str = new char[size 1];

stream.read(str, sizeof(char)*size);

str[size] = "\0";

return str;

} char* SYSSTRINGTOCHAR(System::String^ string)

{ return (char*)(void*)System::Runtime::INTEROPSERVICES::Marshal::STRINGTOHGLOBALANSI(string);

}

System::String^ CHARTOSYSSTRING(char* ch)

{

System::String ^s = gcnew System::String( ch );

return s;

}

Размещено на .ru
Заказать написание новой работы



Дисциплины научных работ



Хотите, перезвоним вам?