
- •Індивідуальне завдання
- •Аналітичний розділ
- •Побудова інформаційно-математичної моделі задачі
- •Об’єктна модель
- •4. Визначення структури даних
- •5. Розробка інтерфейсу програми з користувачем
- •6. Складання коду програми:
- •7. Реалізація проекту у візуальному середовищі
- •8. Аналіз програми
- •9. Тестування програми
- •10. Інструкція з експлуатації програми
- •10.1 Вимоги до технічного забезпечення
- •10.2 Інсталяція програмного забезпечення
- •10.3 Експлуатація програмного продукту
- •11. Аналіз отриманих результатів
11. Аналіз отриманих результатів
Створена програма виконує всі поставлені перед нею задачі, а саме:
Графічна демонстрація роботи списку
Графічна демонстрація роботи черги
Наявність коротких теоретичних відомостей
Зручний, зрозумілий для користувачв інтерфейс
Висновок:
Створена програма виконує певні задачі, тому вона може бути затребуваною, крім того вона може використовуватися в навчальних цілях.
При роботі з цією курсовою я викоритовував знання про обєктно-орієнтоване програмування та знання з предмету «Алгоритми та структури даних».
Розробляючи даний проект я поглибив свої знання в багатьох напрямках, а саме: покращив навички технології ООП, поглибив свої знання з предмету «Алгоритми та структури даних».
Список літератури:
Пахомов Б.И. C/C++ и MS Visual C++ 2008 для начинающих.– СПб.: БХВ – Петербург, 2009. – 624 с.
Павловская Т.А. C/C++. Программирование на языке высокого уровня.– СПб.: Питер, 2003. – 461 с.
http://msdn.microsoft.com/uk-ua/
Прата С. Язык программирования С++. – М.,-СПб.-К.:Diasoft, 2003.
Стєнли Б. Липпман. Основы программирования на С++. – М.-СПб. – К.: Вильямс, 2002.
Додаток А (Реалізація класів)
#include <queue>
#include <list>
#include <windows.h>
#include <iostream>
using namespace std;
using namespace System::Windows::Forms;
using namespace System;
public ref class paint_cherga
{
public:
int i,j,v,k,d,kilk_el;
array <Label^>^mas;
void getel(PictureBox ^ p, TextBox^ b, int i)
{
mas[i]=(gcnew Label);
mas[i]->Top=0;
mas[i]->Left=70;
mas[i]->BackColor=System::Drawing::Color::Green;
mas[i]->Font = (gcnew System::Drawing::Font(L"Monotype Corsiva", 40, System::Drawing::FontStyle::Italic, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(204)));
mas[i]->Text=b->Text;
mas[i]->Width=78;
mas[i]->Height=66;
mas[i]->Parent=p;
mas[i]->TextAlign=System::Drawing::ContentAlignment::MiddleCenter;
}
void create_cherga()
{
mas=gcnew array<Label^>(10);
i=0;
v=760;
kilk_el=0;
}
} ;
public ref class paint_spusok
{
public:
int i,j,n,v,d,s,c,p,z,u,k,kilk_el;
bool check;
array <Label^>^mas;
void addel(PictureBox ^ p,int t, int l, int i)
{
mas[i]=(gcnew Label);
mas[i]->Top=t;
mas[i]->Left=l;
mas[i]->BackColor=System::Drawing::Color::Yellow;
mas[i]->Font = (gcnew System::Drawing::Font(L"Monotype Corsiva", 20, System::Drawing::FontStyle::Italic, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(204)));
mas[i]->Width=78;
mas[i]->Height=33;
mas[i]->Parent=p;
mas[i]->TextAlign=System::Drawing::ContentAlignment::MiddleCenter;
}
void create_spusok()
{
mas=gcnew array<Label^>(20);
i=0;
j=5;
n=10;
z=2;
kilk_el=0;
}
void zsuv()
{
if (v != n)
{
c=mas[v]->Top;
for (int r = v; r < n; r++)
{
mas[r] = mas[r+1];
mas[r-5] = mas[r-4];
mas[r-10] = mas[r-9];
}
}
}
void set_index()
{
int g;
for(int ii=1; ii<=5; ii++)
{
g=0;
for(int jj=5; jj<j; jj++)
{
if (System::Convert::ToInt32(mas[jj]->Text)!=ii)
g++;
}
if (g==kilk_el)
{
z=ii;
break;
}
}
}
void dod_pochatok(Label^ l)
{
for(int jj=0; jj<i; jj++)
if (l->Top > mas[jj]->Top && l->Top < mas[jj]->Top + 33)
s=jj;
d=n-1;
mas[n-1]->BackColor=System::Drawing::Color::Red;
}
void dod_kinets()
{
for(int ii=10; ii<n-1; ii++)
if (mas[ii]->Text=="NUL")
{
d=ii;
mas[ii]->BackColor=System::Drawing::Color::Red;
}
s=i-1;
}
void vud_pochatok(Label^ l)
{
for(int jj=10; jj<n; jj++)
if (l->Top > mas[jj]->Top && l->Top < mas[jj]->Top + 33)
v=jj;
l->Visible=false;
for(int ii=0; ii<i; ii++)
if(mas[ii]->Text==mas[v]->Text)
l->Top=mas[ii]->Top + 4;
delete mas[v];
delete mas[v-5];
delete mas[v-10];
}
void vud_kinets()
{
for(int ii=10; ii<n; ii++)
if (mas[ii]->Text=="NUL")
{
v=ii;
}
for(int ii=10; ii<n; ii++)
if (mas[ii]->Text=="*"+(mas[v-5]->Text))
{
d=ii;
mas[ii]->BackColor=System::Drawing::Color::Red;
}
mas[16]=mas[v];
mas[17]=mas[v-5];
mas[18]=mas[v-10];
}
void up(Label^ l)
{
mas[v]->Top-=4;
mas[v-5]->Top-=4;
mas[v-10]->Top-=4;
if (l->Top > mas[v]->Top && l->Top < mas[v]->Top + 33)
p=1;
if (mas[v]->Top<c+2 && v<n-1)
{
v++;
c+=40;
}
}
void dod_pislya_indeksa_1(ComboBox^ c)
{
for(int ii=5; ii<j; ii++)
if (mas[ii]->Text == c->Text)
d = ii+5;
for(int ii=0; ii<i; ii++)
if (mas[ii]->Text == mas[d]->Text)
k=ii;
mas[d]->BackColor=System::Drawing::Color::Red;
s=i-1;
}
void dod_pislya_indeksa_2()
{
s=k;
d=n-1;
mas[d]->BackColor=System::Drawing::Color::Red;
u=1;
}
void vud_pislya_indeksa(ComboBox^ c)
{
for (int ii=0; ii<i; ii++)
if (mas[ii]->Text=="*" + c->Text)
d=ii+10;
for (int ii=0; ii<i; ii++)
if (mas[ii]->Text == mas[d]->Text)
s=ii+10;
v=s;
mas[16]=mas[v];
mas[17]=mas[v-5];
mas[18]=mas[v-10];
mas[d]->BackColor=System::Drawing::Color::Red;
}
void index_list(ComboBox^ c)
{
c->Items->Clear();
check=false;
for(int ii=10; ii<n; ii++)
if(mas[ii]->Text != "NUL")
{
c->Items->Add(mas[ii-5]->Text);
check=true;
}
}
} ;
Додаток Б (Загальний код програми)
Form1.h:
#pragma once
#include "cherga.h"
#include "Form2.h"
#include "spisok.h"
#include "about.h"
#include "teoria.h"
namespace l {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
/// <summary>
/// Summary for Form1
/// </summary>
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
//
//TODO: Add the constructor code here
//
}
protected:
/// <summary>
/// Clean up any resources being used.
/// </summary>
~Form1()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::Button^ button1;
private: System::Windows::Forms::Button^ button2;
private: System::Windows::Forms::MenuStrip^ menuStrip1;
private: System::Windows::Forms::ToolStripMenuItem^ вихідToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ вихідToolStripMenuItem1;
private: System::Windows::Forms::Label^ label1;
private: System::Windows::Forms::ToolStripMenuItem^ проПрограмуToolStripMenuItem;
private: System::Windows::Forms::Button^ button3;
protected:
private:
/// <summary>
/// Required designer variable.
/// </summary>
System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
void InitializeComponent(void)
{
System::ComponentModel::ComponentResourceManager^ resources = (gcnew System::ComponentModel::ComponentResourceManager(Form1::typeid));
this->button1 = (gcnew System::Windows::Forms::Button());
this->button2 = (gcnew System::Windows::Forms::Button());
this->menuStrip1 = (gcnew System::Windows::Forms::MenuStrip());
this->вихідToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->проПрограмуToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->вихідToolStripMenuItem1 = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->label1 = (gcnew System::Windows::Forms::Label());
this->button3 = (gcnew System::Windows::Forms::Button());
this->menuStrip1->SuspendLayout();
this->SuspendLayout();
//
// button1
//
this->button1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 25, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(204)));
this->button1->Location = System::Drawing::Point(23, 231);
this->button1->Name = L"button1";
this->button1->Size = System::Drawing::Size(434, 53);
this->button1->TabIndex = 0;
this->button1->Text = L"Демонстрація черги";
this->button1->UseVisualStyleBackColor = true;
this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
//
// button2
//
this->button2->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 25, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(204)));
this->button2->Location = System::Drawing::Point(23, 138);
this->button2->Name = L"button2";
this->button2->Size = System::Drawing::Size(434, 53);
this->button2->TabIndex = 1;
this->button2->Text = L"Демонстрація списку";
this->button2->UseVisualStyleBackColor = true;
this->button2->Click += gcnew System::EventHandler(this, &Form1::button2_Click);
//
// menuStrip1
//
this->menuStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(1) {this->вихідToolStripMenuItem});
this->menuStrip1->Location = System::Drawing::Point(0, 0);
this->menuStrip1->Name = L"menuStrip1";
this->menuStrip1->Size = System::Drawing::Size(472, 24);
this->menuStrip1->TabIndex = 2;
this->menuStrip1->Text = L"menuStrip1";
//
// вихідToolStripMenuItem
//
this->вихідToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(2) {this->проПрограмуToolStripMenuItem,
this->вихідToolStripMenuItem1});
this->вихідToolStripMenuItem->Name = L"вихідToolStripMenuItem";
this->вихідToolStripMenuItem->Size = System::Drawing::Size(48, 20);
this->вихідToolStripMenuItem->Text = L"Меню";
//
// проПрограмуToolStripMenuItem
//
this->проПрограмуToolStripMenuItem->Name = L"проПрограмуToolStripMenuItem";
this->проПрограмуToolStripMenuItem->Size = System::Drawing::Size(154, 22);
this->проПрограмуToolStripMenuItem->Text = L"Про програму";
this->проПрограмуToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::проПрограмуToolStripMenuItem_Click);
//
// вихідToolStripMenuItem1
//
this->вихідToolStripMenuItem1->Name = L"вихідToolStripMenuItem1";
this->вихідToolStripMenuItem1->Size = System::Drawing::Size(154, 22);
this->вихідToolStripMenuItem1->Text = L"Вихід";
this->вихідToolStripMenuItem1->Click += gcnew System::EventHandler(this, &Form1::вихідToolStripMenuItem1_Click);
//
// label1
//
this->label1->AutoSize = true;
this->label1->BackColor = System::Drawing::SystemColors::Control;
this->label1->Font = (gcnew System::Drawing::Font(L"Monotype Corsiva", 40, static_cast<System::Drawing::FontStyle>((System::Drawing::FontStyle::Bold | System::Drawing::FontStyle::Italic)),
System::Drawing::GraphicsUnit::Point, static_cast<System::Byte>(204)));
this->label1->ForeColor = System::Drawing::Color::Peru;
this->label1->Location = System::Drawing::Point(12, 50);
this->label1->Name = L"label1";
this->label1->Size = System::Drawing::Size(445, 65);
this->label1->TabIndex = 3;
this->label1->Text = L"Оберіть категорію:";
this->label1->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
//
// button3
//
this->button3->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 25, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(204)));
this->button3->Location = System::Drawing::Point(23, 327);
this->button3->Name = L"button3";
this->button3->Size = System::Drawing::Size(434, 53);
this->button3->TabIndex = 4;
this->button3->Text = L"Теоретичні відомості";
this->button3->UseVisualStyleBackColor = true;
this->button3->Click += gcnew System::EventHandler(this, &Form1::button3_Click);
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->BackgroundImage = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"$this.BackgroundImage")));
this->BackgroundImageLayout = System::Windows::Forms::ImageLayout::Stretch;
this->ClientSize = System::Drawing::Size(472, 416);
this->Controls->Add(this->button3);
this->Controls->Add(this->label1);
this->Controls->Add(this->button2);
this->Controls->Add(this->button1);
this->Controls->Add(this->menuStrip1);
this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::None;
this->MainMenuStrip = this->menuStrip1;
this->Name = L"Form1";
this->menuStrip1->ResumeLayout(false);
this->menuStrip1->PerformLayout();
this->ResumeLayout(false);
this->PerformLayout();
}
#pragma endregion
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
this->Visible=false;
Form2 ^ form2 =gcnew Form2();
form2->ShowDialog();
this->Show();
}
private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) {
this->Visible=false;
spisok^ form3 = gcnew spisok();
form3->ShowDialog();
this->Show();
}
private: System::Void вихідToolStripMenuItem1_Click(System::Object^ sender, System::EventArgs^ e) {
Close();
}
private: System::Void проПрограмуToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e)
{
this->Visible=false;
about^ form4 = gcnew about();
form4->ShowDialog();
this->Show();
}
private: System::Void button3_Click(System::Object^ sender, System::EventArgs^ e)
{
this->Visible=false;
teoria^ form5 = gcnew teoria();
form5->ShowDialog();
this->Show();
}
};
}
Form2.h:
#pragma once
//#include "cherga.h"
#include <time.h>
#include <stdlib.h>
#include <windows.h>
#include <iostream>
namespace l {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
using namespace std;
using namespace Microsoft::VisualBasic::PowerPacks;
/// <summary>
/// Summary for Form2
/// </summary>
public ref class Form2 : public System::Windows::Forms::Form
{
private: System::Windows::Forms::Timer^ timer2;
private: System::Windows::Forms::Timer^ timer3;
private: System::Windows::Forms::PictureBox^ pictureBox1;
paint_cherga x;
public:
Form2(void)
{
InitializeComponent();
//
//TODO: Add the constructor code here
//
}
protected:
/// <summary>
/// Clean up any resources being used.
/// </summary>
~Form2()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::GroupBox^ groupBox1;
private: System::Windows::Forms::TextBox^ textBox1;
private: System::Windows::Forms::MenuStrip^ menuStrip1;
private: System::Windows::Forms::ToolStripMenuItem^ вихідToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ вихідToolStripMenuItem1;
private: System::Windows::Forms::Button^ button2;
private: System::Windows::Forms::Button^ button1;
private: System::Windows::Forms::Timer^ timer1;
private: System::Windows::Forms::Button^ button3;
private: System::ComponentModel::IContainer^ components;
protected:
private:
/// <summary>
/// Required designer variable.
/// </summary>
#pragma region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
void InitializeComponent(void)
{
this->components = (gcnew System::ComponentModel::Container());
System::ComponentModel::ComponentResourceManager^ resources = (gcnew System::ComponentModel::ComponentResourceManager(Form2::typeid));
this->groupBox1 = (gcnew System::Windows::Forms::GroupBox());
this->button3 = (gcnew System::Windows::Forms::Button());
this->button2 = (gcnew System::Windows::Forms::Button());
this->button1 = (gcnew System::Windows::Forms::Button());
this->textBox1 = (gcnew System::Windows::Forms::TextBox());
this->menuStrip1 = (gcnew System::Windows::Forms::MenuStrip());
this->вихідToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->вихідToolStripMenuItem1 = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->timer1 = (gcnew System::Windows::Forms::Timer(this->components));
this->timer2 = (gcnew System::Windows::Forms::Timer(this->components));
this->timer3 = (gcnew System::Windows::Forms::Timer(this->components));
this->pictureBox1 = (gcnew System::Windows::Forms::PictureBox());
this->groupBox1->SuspendLayout();
this->menuStrip1->SuspendLayout();
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->pictureBox1))->BeginInit();
this->SuspendLayout();
//
// groupBox1
//
this->groupBox1->Controls->Add(this->button3);
this->groupBox1->Controls->Add(this->button2);
this->groupBox1->Controls->Add(this->button1);
this->groupBox1->Controls->Add(this->textBox1);
this->groupBox1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 10, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(204)));
this->groupBox1->ForeColor = System::Drawing::Color::Red;
this->groupBox1->Location = System::Drawing::Point(0, 27);
this->groupBox1->Name = L"groupBox1";
this->groupBox1->Size = System::Drawing::Size(988, 127);
this->groupBox1->TabIndex = 3;
this->groupBox1->TabStop = false;
this->groupBox1->Text = L"Робота з чергою";
//
// button3
//
this->button3->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 20, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(204)));
this->button3->ForeColor = System::Drawing::Color::MediumOrchid;
this->button3->Location = System::Drawing::Point(12, 20);
this->button3->Name = L"button3";
this->button3->Size = System::Drawing::Size(289, 52);
this->button3->TabIndex = 5;
this->button3->Text = L"Створити чергу";
this->button3->UseVisualStyleBackColor = true;
this->button3->Click += gcnew System::EventHandler(this, &Form2::button3_Click);
//
// button2
//
this->button2->Enabled = false;
this->button2->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 20, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(204)));
this->button2->ForeColor = System::Drawing::Color::MediumOrchid;
this->button2->Location = System::Drawing::Point(687, 22);
this->button2->Name = L"button2";
this->button2->Size = System::Drawing::Size(289, 50);
this->button2->TabIndex = 4;
this->button2->Text = L"Видалити елемент";
this->button2->UseVisualStyleBackColor = true;
this->button2->Click += gcnew System::EventHandler(this, &Form2::button2_Click);
//
// button1
//
this->button1->Enabled = false;
this->button1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 20, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(204)));
this->button1->ForeColor = System::Drawing::Color::MediumOrchid;
this->button1->Location = System::Drawing::Point(345, 20);
this->button1->Name = L"button1";
this->button1->Size = System::Drawing::Size(289, 52);
this->button1->TabIndex = 3;
this->button1->Text = L"Додати елемент";
this->button1->UseVisualStyleBackColor = true;
this->button1->Click += gcnew System::EventHandler(this, &Form2::button1_Click);
//
// textBox1
//
this->textBox1->Enabled = false;
this->textBox1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 20, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(204)));
this->textBox1->Location = System::Drawing::Point(345, 83);
this->textBox1->Name = L"textBox1";
this->textBox1->Size = System::Drawing::Size(289, 38);
this->textBox1->TabIndex = 1;
this->textBox1->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &Form2::textBox1_KeyPress);
//
// menuStrip1
//
this->menuStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(1) {this->вихідToolStripMenuItem});
this->menuStrip1->Location = System::Drawing::Point(0, 0);
this->menuStrip1->Name = L"menuStrip1";
this->menuStrip1->Size = System::Drawing::Size(988, 24);
this->menuStrip1->TabIndex = 4;
this->menuStrip1->Text = L"menuStrip1";
//
// вихідToolStripMenuItem
//
this->вихідToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(1) {this->вихідToolStripMenuItem1});
this->вихідToolStripMenuItem->Name = L"вихідToolStripMenuItem";
this->вихідToolStripMenuItem->Size = System::Drawing::Size(46, 20);
this->вихідToolStripMenuItem->Text = L"Вихід";
//
// вихідToolStripMenuItem1
//
this->вихідToolStripMenuItem1->Name = L"вихідToolStripMenuItem1";
this->вихідToolStripMenuItem1->Size = System::Drawing::Size(142, 22);
this->вихідToolStripMenuItem1->Text = L"На головну";
this->вихідToolStripMenuItem1->Click += gcnew System::EventHandler(this, &Form2::вихідToolStripMenuItem1_Click);
//
// timer1
//
this->timer1->Tick += gcnew System::EventHandler(this, &Form2::timer1_Tick);
//
// timer2
//
this->timer2->Tick += gcnew System::EventHandler(this, &Form2::timer2_Tick);
//
// timer3
//
this->timer3->Tick += gcnew System::EventHandler(this, &Form2::timer3_Tick);
//
// pictureBox1
//
this->pictureBox1->Image = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"pictureBox1.Image")));
this->pictureBox1->Location = System::Drawing::Point(0, 160);
this->pictureBox1->Name = L"pictureBox1";
this->pictureBox1->Size = System::Drawing::Size(988, 454);
this->pictureBox1->TabIndex = 0;
this->pictureBox1->TabStop = false;
this->pictureBox1->Visible = false;
//
// Form2
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(988, 153);
this->Controls->Add(this->pictureBox1);
this->Controls->Add(this->groupBox1);
this->Controls->Add(this->menuStrip1);
this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::None;
this->MainMenuStrip = this->menuStrip1;
this->Name = L"Form2";
this->StartPosition = System::Windows::Forms::FormStartPosition::Manual;
this->groupBox1->ResumeLayout(false);
this->groupBox1->PerformLayout();
this->menuStrip1->ResumeLayout(false);
this->menuStrip1->PerformLayout();
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->pictureBox1))->EndInit();
this->ResumeLayout(false);
this->PerformLayout();
}
#pragma endregion
private: System::Void вихідToolStripMenuItem1_Click(System::Object^ sender, System::EventArgs^ e) {
delete x.mas;
timer1->Stop();
timer2->Stop();
Close();
}
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
if (x.kilk_el>=9)
{
MessageBox::Show("Черга переповнена");
return;
}
if (textBox1->Text!=""){
if (textBox1->Text->Length>2)
{
MessageBox::Show("Можна вводити значення з діапазону 0..99");
textBox1->Clear();
return;
}
x.kilk_el++;
x.getel(pictureBox1,textBox1,x.i);
if (x.kilk_el>1)
x.v-=x.mas[x.i]->Width + 2;
else
x.v=760;
timer1->Start();
button1->Enabled=false;
button2->Enabled=false;
textBox1->Enabled=false;
textBox1->Clear();
}
else
MessageBox::Show("Введіть значення!!!");
}
private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) {
textBox1->Clear();
if (x.kilk_el>0)
{
x.mas[9]=x.mas[0];
x.kilk_el--;
if (x.i>1)
x.j=x.mas[x.i-2]->Left;
for (int ii=0; ii<x.i; ii++)
x.mas[ii] = x.mas[ii+1];
x.i--;
x.d=x.mas[9]->Left;
x.k=0;
timer2->Start();
button1->Enabled=false;
button2->Enabled=false;
textBox1->Enabled=false;
}
else
MessageBox::Show("Черга порожня");
}
private: System::Void timer1_Tick(System::Object^ sender, System::EventArgs^ e) {
if (x.mas[x.i]->Top<=135)
x.mas[x.i]->Top+=4;
if(x.mas[x.i]->Left<x.v && x.mas[x.i]->Top>133)
x.mas[x.i]->Left+=8;
if (x.mas[x.i]->Top>133 && x.mas[x.i]->Left>x.v-7)
{
button1->Enabled=true;
button2->Enabled=true;
textBox1->Enabled=true;
timer1->Stop();
x.i++;
}
}
private: System::Void timer2_Tick(System::Object^ sender, System::EventArgs^ e)
{
if (x.mas[9]->Left<=837)
x.mas[9]->Left+=4;
if (x.mas[9]->Top<=340 && x.mas[9]->Left>834)
x.mas[9]->Top+=4;
if (x.mas[9]->Top>337 && x.mas[9]->Left>=834 && x.kilk_el>=1)
{
if (x.mas[x.k]->Left<=x.d)
x.mas[x.k]->Left+=8;
if (x.mas[x.k]->Left>x.d-7 && x.k<x.i)
{
x.d-=80;
x.k++;
}
};
if (x.i==0)
x.i=10;
if (x.mas[9]->Top>343 && x.mas[9]->Left>=834 && x.mas[x.i-1]->Left>=x.j-3){
if (x.kilk_el==0)
x.i=0;
Sleep(100);
delete x.mas[9];
x.v+=80;
timer2->Stop();
button1->Enabled=true;
button2->Enabled=true;
textBox1->Enabled=true;
};
}
private: System::Void button3_Click(System::Object^ sender, System::EventArgs^ e) {
x.create_cherga();
button3->Enabled=false;
timer3->Start();
}
private: System::Void timer3_Tick(System::Object^ sender, System::EventArgs^ e) {
if(Form2::Height<615)
Form2::Height+=20;
else
{
timer3->Stop();
pictureBox1->Visible=true;
button1->Enabled=true;
button2->Enabled=true;
textBox1->Enabled=true;
}
}
private: System::Void textBox1_KeyPress(System::Object^ sender, System::Windows::Forms::KeyPressEventArgs^ e)
{
if((e->KeyChar<'0' || e->KeyChar>'9') && e->KeyChar != (char)8)
e->KeyChar=(char)0;
}
};
}
spisok.h:
#pragma once
namespace l {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
/// <summary>
/// Summary for spisok
/// </summary>
public ref class spisok : public System::Windows::Forms::Form
{
paint_spusok y;
private: System::Windows::Forms::Label^ label3;
private: System::Windows::Forms::Timer^ timer2;
private: System::Windows::Forms::Timer^ timer3;
private: System::Windows::Forms::Button^ button4;
private: System::Windows::Forms::Label^ label4;
private: System::Windows::Forms::Timer^ timer4;
private: System::Windows::Forms::ComboBox^ comboBox4;
private: System::Windows::Forms::ComboBox^ comboBox3;
int i;
public:
spisok(void)
{
i=0;
InitializeComponent();
//
//TODO: Add the constructor code here
//
}
protected:
/// <summary>
/// Clean up any resources being used.
/// </summary>
~spisok()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::MenuStrip^ menuStrip1;
private: System::Windows::Forms::ToolStripMenuItem^ вихідToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ наГоловнуToolStripMenuItem;
private: System::Windows::Forms::GroupBox^ groupBox1;
private: System::Windows::Forms::PictureBox^ pictureBox1;
private: System::Windows::Forms::Label^ label1;
private: System::Windows::Forms::Label^ label2;
private: System::Windows::Forms::ComboBox^ comboBox1;
private: System::Windows::Forms::Button^ button1;
private: System::Windows::Forms::ComboBox^ comboBox2;
private: System::Windows::Forms::Button^ button2;
private: System::Windows::Forms::Timer^ timer1;
private: System::Windows::Forms::Button^ button3;
private: System::ComponentModel::IContainer^ components;
protected:
private:
/// <summary>
/// Required designer variable.
/// </summary>
#pragma region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
void InitializeComponent(void)
{
this->components = (gcnew System::ComponentModel::Container());
System::ComponentModel::ComponentResourceManager^ resources = (gcnew System::ComponentModel::ComponentResourceManager(spisok::typeid));
this->menuStrip1 = (gcnew System::Windows::Forms::MenuStrip());
this->вихідToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->наГоловнуToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->groupBox1 = (gcnew System::Windows::Forms::GroupBox());
this->comboBox4 = (gcnew System::Windows::Forms::ComboBox());
this->comboBox3 = (gcnew System::Windows::Forms::ComboBox());
this->button4 = (gcnew System::Windows::Forms::Button());
this->button3 = (gcnew System::Windows::Forms::Button());
this->comboBox2 = (gcnew System::Windows::Forms::ComboBox());
this->button2 = (gcnew System::Windows::Forms::Button());
this->comboBox1 = (gcnew System::Windows::Forms::ComboBox());
this->button1 = (gcnew System::Windows::Forms::Button());
this->pictureBox1 = (gcnew System::Windows::Forms::PictureBox());
this->label1 = (gcnew System::Windows::Forms::Label());
this->label2 = (gcnew System::Windows::Forms::Label());
this->timer1 = (gcnew System::Windows::Forms::Timer(this->components));
this->label3 = (gcnew System::Windows::Forms::Label());
this->timer2 = (gcnew System::Windows::Forms::Timer(this->components));
this->timer3 = (gcnew System::Windows::Forms::Timer(this->components));
this->label4 = (gcnew System::Windows::Forms::Label());
this->timer4 = (gcnew System::Windows::Forms::Timer(this->components));
this->menuStrip1->SuspendLayout();
this->groupBox1->SuspendLayout();
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->pictureBox1))->BeginInit();
this->SuspendLayout();
//
// menuStrip1
//
this->menuStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(1) {this->вихідToolStripMenuItem});
this->menuStrip1->Location = System::Drawing::Point(0, 0);
this->menuStrip1->Name = L"menuStrip1";
this->menuStrip1->Size = System::Drawing::Size(636, 24);
this->menuStrip1->TabIndex = 1;
this->menuStrip1->Text = L"menuStrip1";
//
// вихідToolStripMenuItem
//
this->вихідToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(1) {this->наГоловнуToolStripMenuItem});
this->вихідToolStripMenuItem->Name = L"вихідToolStripMenuItem";
this->вихідToolStripMenuItem->Size = System::Drawing::Size(46, 20);
this->вихідToolStripMenuItem->Text = L"Вихід";
//
// наГоловнуToolStripMenuItem
//
this->наГоловнуToolStripMenuItem->Name = L"наГоловнуToolStripMenuItem";
this->наГоловнуToolStripMenuItem->Size = System::Drawing::Size(142, 22);
this->наГоловнуToolStripMenuItem->Text = L"На головну";
this->наГоловнуToolStripMenuItem->Click += gcnew System::EventHandler(this, &spisok::наГоловнуToolStripMenuItem_Click);
//
// groupBox1
//
this->groupBox1->BackgroundImageLayout = System::Windows::Forms::ImageLayout::Center;
this->groupBox1->Controls->Add(this->comboBox4);
this->groupBox1->Controls->Add(this->comboBox3);
this->groupBox1->Controls->Add(this->button4);
this->groupBox1->Controls->Add(this->button3);
this->groupBox1->Controls->Add(this->comboBox2);
this->groupBox1->Controls->Add(this->button2);
this->groupBox1->Controls->Add(this->comboBox1);
this->groupBox1->Controls->Add(this->button1);
this->groupBox1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 10, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(204)));
this->groupBox1->ForeColor = System::Drawing::Color::Red;
this->groupBox1->Location = System::Drawing::Point(0, 27);
this->groupBox1->Name = L"groupBox1";
this->groupBox1->Size = System::Drawing::Size(636, 102);
this->groupBox1->TabIndex = 2;
this->groupBox1->TabStop = false;
this->groupBox1->Text = L"Робота зі списком";
//
// comboBox4
//
this->comboBox4->DropDownStyle = System::Windows::Forms::ComboBoxStyle::DropDownList;
this->comboBox4->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 14, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(204)));
this->comboBox4->FormattingEnabled = true;
this->comboBox4->Location = System::Drawing::Point(593, 57);
this->comboBox4->Name = L"comboBox4";
this->comboBox4->Size = System::Drawing::Size(37, 32);
this->comboBox4->TabIndex = 12;
this->comboBox4->Visible = false;
//
// comboBox3
//
this->comboBox3->DropDownStyle = System::Windows::Forms::ComboBoxStyle::DropDownList;
this->comboBox3->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 14, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(204)));
this->comboBox3->FormattingEnabled = true;
this->comboBox3->Location = System::Drawing::Point(593, 18);
this->comboBox3->Name = L"comboBox3";
this->comboBox3->Size = System::Drawing::Size(37, 32);
this->comboBox3->TabIndex = 11;
this->comboBox3->Visible = false;
//
// button4
//
this->button4->Enabled = false;
this->button4->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 14, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(204)));
this->button4->ForeColor = System::Drawing::Color::MediumOrchid;
this->button4->Location = System::Drawing::Point(8, 57);
this->button4->Name = L"button4";
this->button4->Size = System::Drawing::Size(190, 32);
this->button4->TabIndex = 10;
this->button4->Text = L"Створити елемент";
this->button4->UseVisualStyleBackColor = true;
this->button4->Click += gcnew System::EventHandler(this, &spisok::button4_Click);
//
// button3
//
this->button3->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 14, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(204)));
this->button3->ForeColor = System::Drawing::Color::MediumOrchid;
this->button3->Location = System::Drawing::Point(8, 18);
this->button3->Name = L"button3";
this->button3->Size = System::Drawing::Size(190, 33);
this->button3->TabIndex = 9;
this->button3->Text = L"Створити список";
this->button3->UseVisualStyleBackColor = true;
this->button3->Click += gcnew System::EventHandler(this, &spisok::button3_Click);
//
// comboBox2
//
this->comboBox2->DropDownStyle = System::Windows::Forms::ComboBoxStyle::DropDownList;
this->comboBox2->Enabled = false;
this->comboBox2->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 14, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(204)));
this->comboBox2->FormattingEnabled = true;
this->comboBox2->Items->AddRange(gcnew cli::array< System::Object^ >(3) {L"З початку списку", L"З кінця списку", L"Після елементу №"});
this->comboBox2->Location = System::Drawing::Point(399, 58);
this->comboBox2->Name = L"comboBox2";
this->comboBox2->Size = System::Drawing::Size(188, 32);
this->comboBox2->TabIndex = 5;
//
// button2
//
this->button2->Enabled = false;
this->button2->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 14, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(204)));
this->button2->ForeColor = System::Drawing::Color::MediumOrchid;
this->button2->Location = System::Drawing::Point(204, 58);
this->button2->Name = L"button2";
this->button2->Size = System::Drawing::Size(189, 32);
this->button2->TabIndex = 8;
this->button2->Text = L"Видалити елемент";
this->button2->UseVisualStyleBackColor = true;
this->button2->Click += gcnew System::EventHandler(this, &spisok::button2_Click);
//
// comboBox1
//
this->comboBox1->DropDownStyle = System::Windows::Forms::ComboBoxStyle::DropDownList;
this->comboBox1->Enabled = false;
this->comboBox1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 14, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(204)));
this->comboBox1->FormattingEnabled = true;
this->comboBox1->Items->AddRange(gcnew cli::array< System::Object^ >(3) {L"На початок списку", L"У кінець списку", L"Після елементу №"});
this->comboBox1->Location = System::Drawing::Point(399, 19);
this->comboBox1->Name = L"comboBox1";
this->comboBox1->Size = System::Drawing::Size(188, 32);
this->comboBox1->TabIndex = 7;
//
// button1
//
this->button1->Enabled = false;
this->button1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 14, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(204)));
this->button1->ForeColor = System::Drawing::Color::MediumOrchid;
this->button1->Location = System::Drawing::Point(204, 19);
this->button1->Name = L"button1";
this->button1->Size = System::Drawing::Size(189, 33);
this->button1->TabIndex = 6;
this->button1->Text = L"Додати елемент";
this->button1->UseVisualStyleBackColor = true;
this->button1->Click += gcnew System::EventHandler(this, &spisok::button1_Click);
//
// pictureBox1
//
this->pictureBox1->Image = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"pictureBox1.Image")));
this->pictureBox1->Location = System::Drawing::Point(0, 220);
this->pictureBox1->Name = L"pictureBox1";
this->pictureBox1->Size = System::Drawing::Size(630, 281);
this->pictureBox1->TabIndex = 3;
this->pictureBox1->TabStop = false;
//
// label1
//
this->label1->AutoSize = true;
this->label1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 18, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(204)));
this->label1->Location = System::Drawing::Point(12, 178);
this->label1->Name = L"label1";
this->label1->Size = System::Drawing::Size(132, 29);
this->label1->TabIndex = 4;
this->label1->Text = L"Статична";
//
// label2
//
this->label2->AutoSize = true;
this->label2->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 18, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(204)));
this->label2->Location = System::Drawing::Point(209, 178);
this->label2->Name = L"label2";
this->label2->Size = System::Drawing::Size(154, 29);
this->label2->TabIndex = 0;
this->label2->Text = L"Динамічна ";
//
// timer1
//
this->timer1->Tick += gcnew System::EventHandler(this, &spisok::timer1_Tick);
//
// label3
//
this->label3->AutoSize = true;
this->label3->Font = (gcnew System::Drawing::Font(L"Times New Roman", 30, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(204)));
this->label3->ForeColor = System::Drawing::Color::CornflowerBlue;
this->label3->Location = System::Drawing::Point(236, 132);
this->label3->Name = L"label3";
this->label3->Size = System::Drawing::Size(157, 46);
this->label3->TabIndex = 5;
this->label3->Text = L"Пам’ять";
//
// timer2
//
this->timer2->Tick += gcnew System::EventHandler(this, &spisok::timer2_Tick);
//
// timer3
//
this->timer3->Tick += gcnew System::EventHandler(this, &spisok::timer3_Tick);
//
// label4
//
this->label4->AutoSize = true;
this->label4->BackColor = System::Drawing::Color::Tomato;
this->label4->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 15.75F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(204)));
this->label4->Location = System::Drawing::Point(35, 132);
this->label4->Name = L"label4";
this->label4->Size = System::Drawing::Size(33, 25);
this->label4->TabIndex = 6;
this->label4->Text = L"->";
this->label4->Visible = false;
//
// timer4
//
this->timer4->Tick += gcnew System::EventHandler(this, &spisok::timer4_Tick);
//
// spisok
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(636, 124);
this->Controls->Add(this->label4);
this->Controls->Add(this->label3);
this->Controls->Add(this->pictureBox1);
this->Controls->Add(this->label1);
this->Controls->Add(this->groupBox1);
this->Controls->Add(this->label2);
this->Controls->Add(this->menuStrip1);
this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::None;
this->MainMenuStrip = this->menuStrip1;
this->Name = L"spisok";
this->menuStrip1->ResumeLayout(false);
this->menuStrip1->PerformLayout();
this->groupBox1->ResumeLayout(false);
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->pictureBox1))->EndInit();
this->ResumeLayout(false);
this->PerformLayout();
}
#pragma endregion
private: System::Void наГоловнуToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e)
{
delete y.mas;
Close();
timer2->Stop();
timer3->Stop();
}
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e)
{
comboBox2->SelectedIndex=-1;
if (comboBox1->Text=="")
{
MessageBox::Show("Виберіть місце вставки нового елемента!");
return;
}
y.kilk_el++;
if(comboBox1->SelectedIndex==0)
{
y.dod_pochatok(label4);
label4->Top+=40*(y.i-y.s-1);
}
else
if(comboBox1->SelectedIndex==1)
y.dod_kinets();
else
{
if(!y.check)
{
MessageBox::Show("Ця дія тимчасово недоступна");
comboBox1->SelectedIndex=-1;
return;
}
else
if(comboBox3->Text == "")
{
MessageBox::Show("Виберіть індекс після якого потрібно вставити елемент");
return;
}
y.dod_pislya_indeksa_1(comboBox3);
}
timer2->Start();
button1->Enabled=false;
button2->Enabled=false;
button4->Enabled=false;
comboBox1->Enabled=false;
comboBox2->Enabled=false;
}
private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e)
{
y.p=0;
if (comboBox2->Text=="")
{
MessageBox::Show("Виберіть елемент для видалення!");
return;
}
if (y.kilk_el>=1)
{
if (comboBox2->SelectedIndex==0)
{
if (y.kilk_el>1)
{
y.vud_pochatok(label4);
y.kilk_el--;
}
else
{
y.kilk_el--;
delete y.mas[0];
delete y.mas[5];
delete y.mas[10];
}
}
if (comboBox2->SelectedIndex==1)
{
if (y.kilk_el>1)
{
y.vud_kinets();
}
else
{
delete y.mas[y.i-1];
delete y.mas[y.j-1];
delete y.mas[y.n-1];
}
y.kilk_el--;
}
if (comboBox2->SelectedIndex == 2)
{
if(!y.check)
{
MessageBox::Show("Ця дія тимчасово недоступна");
comboBox2->SelectedIndex=-1;
return;
}
else
if(comboBox4->Text == "")
{
MessageBox::Show("Виберіть індекс після якого потрібно видалити елемент ");
return;
}
y.vud_pislya_indeksa(comboBox4);
timer2->Start();
y.kilk_el--;
}
if (y.kilk_el<1)
{
label4->Visible=false;
button3->Enabled=true;
button1->Enabled=false;
button2->Enabled=false;
button4->Enabled=false;
comboBox1->Enabled=false;
comboBox2->Enabled=false;
return;
}
else
if(comboBox2->SelectedIndex != 2)
{
button2->Enabled=false;
comboBox2->Enabled=false;
button4->Enabled=false;
timer2->Start();
}
}
else
MessageBox::Show("Список порожній");
}
private: System::Void timer1_Tick(System::Object^ sender, System::EventArgs^ e)
{
if (spisok::Height<539)
spisok::Height+=16;
else
{
timer1->Stop();
y.kilk_el++;
y.addel(pictureBox1,50+20*y.i,80,y.i);
y.mas[y.i]->Text="*1";
y.addel(pictureBox1,50+20*y.i,240,y.j);
y.mas[y.j]->Text="1";
y.addel(pictureBox1,50+20*y.i,320,y.n);
y.mas[y.n]->Width=140;
y.mas[y.n]->Text="NUL";
y.i++;
y.j++;
y.n++;
label4->Visible=true;
button4->Enabled=true;
button2->Enabled=true;
comboBox2->Enabled=true;
}
}
private: System::Void button3_Click(System::Object^ sender, System::EventArgs^ e)
{
y.create_spusok();
label4->Parent=pictureBox1;
label4->Top=50+20*y.i+4;
timer1->Start();
button3->Enabled=false;
timer3->Start();
y.index_list(comboBox4);
}
private: System::Void timer2_Tick(System::Object^ sender, System::EventArgs^ e)
{
if (y.mas[y.d]->Left<480 && y.mas[y.d]->BackColor==System::Drawing::Color::Red)
y.mas[y.d]->Left+=4;
if(y.mas[y.d]->Left>=477 && y.mas[y.d]->BackColor==System::Drawing::Color::Red)
{
Sleep(1000);
if (comboBox2->SelectedIndex==1)
y.mas[y.d]->Text="NUL";
else
y.mas[y.d]->Text=y.mas[y.s]->Text;
y.mas[y.d]->BackColor=System::Drawing::Color::Yellow;
}
if (y.mas[y.d]->Left>320 && y.mas[y.d]->BackColor==System::Drawing::Color::Yellow)
y.mas[y.d]->Left-=4;
if (y.mas[y.d]->Left<=323 && y.mas[y.d]->BackColor==System::Drawing::Color::Yellow)
{
timer2->Stop();
if (comboBox2->SelectedIndex==0 || comboBox2->SelectedIndex==1 || comboBox2->SelectedIndex==2)
{
y.i--;
y.j--;
y.n--;
if (label4->Top > y.mas[y.v]->Top && label4->Top < y.mas[y.v]->Top + 33)
y.p=1;
y.zsuv();
if (y.v != y.n)
{
timer4->Start();
label4->Visible=false;
}
else
{
button2->Enabled=true;
comboBox2->Enabled=true;
button4->Enabled=true;
label4->Visible=true;
}
}
if (comboBox2->SelectedIndex==1 || comboBox2->SelectedIndex==2)
{
delete y.mas[16];
delete y.mas[17];
delete y.mas[18];
}
if (comboBox1->SelectedIndex==0 || comboBox1->SelectedIndex==1)
{
comboBox1->SelectedIndex=-1;
button4->Enabled=true;
button2->Enabled=true;
comboBox2->Enabled=true;
comboBox2->SelectedIndex=-1;
}
else
comboBox2->SelectedIndex=-1;
y.set_index();
if (comboBox1->SelectedIndex==2)
{
y.dod_pislya_indeksa_2();
timer2->Start();
comboBox1->SelectedIndex=-1;
y.mas[y.d]->Left+=4;
}
if (y.mas[y.d]->Left<323 && y.u==1)
{
button4->Enabled=true;
button2->Enabled=true;
comboBox2->Enabled=true;
y.u=0;
}
y.index_list(comboBox4);
}
}
private: System::Void button4_Click(System::Object^ sender, System::EventArgs^ e)
{
comboBox2->SelectedIndex=-1;
y.index_list(comboBox3);
if (y.kilk_el>4)
{
MessageBox::Show("Список переповнений");
return;
}
y.addel(pictureBox1,50+40*y.i,80,y.i);
y.mas[y.i]->Text="*"+System::Convert::ToString(y.z);
y.addel(pictureBox1,50+40*y.i,240,y.j);
y.mas[y.j]->Text=System::Convert::ToString(y.z);
y.addel(pictureBox1,50+40*y.i,320,y.n);
y.mas[y.n]->Width=140;
y.mas[y.n]->Text="NUL";
y.i++;
y.j++;
y.n++;
button1->Enabled=true;
button2->Enabled=false;
button4->Enabled=false;
comboBox1->Enabled=true;
comboBox2->Enabled=false;
}
private: System::Void timer3_Tick(System::Object^ sender, System::EventArgs^ e)
{
if (comboBox1->SelectedIndex==2)
comboBox3->Visible=true;
else
comboBox3->Visible=false;
if (comboBox2->SelectedIndex==2)
comboBox4->Visible=true;
else
comboBox4->Visible=false;
}
private: System::Void timer4_Tick(System::Object^ sender, System::EventArgs^ e)
{
if (y.mas[y.v]->Top>y.c)
y.up(label4);
else
{
timer4->Stop();
if (y.p==1)
label4->Top-=40;
comboBox2->SelectedIndex=-1;
button2->Enabled=true;
comboBox2->Enabled=true;
button4->Enabled=true;
label4->Visible=true;
}
}
};
}
teoria.h
#pragma once
namespace l {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
/// <summary>
/// Summary for teoria
/// </summary>
public ref class teoria : public System::Windows::Forms::Form
{
public:
teoria(void)
{
InitializeComponent();
//
//TODO: Add the constructor code here
//
}
protected:
/// <summary>
/// Clean up any resources being used.
/// </summary>
~teoria()
{
if (components)
{
delete components;
}
}
protected:
private: System::Windows::Forms::RichTextBox^ richTextBox1;
private: System::Windows::Forms::MenuStrip^ menuStrip1;
private: System::Windows::Forms::ToolStripMenuItem^ вихідToolStripMenuItem;
private: System::Windows::Forms::ToolStripMenuItem^ наГоловнуToolStripMenuItem;
private: System::Windows::Forms::Label^ label1;
private: System::Windows::Forms::ToolStripMenuItem^ завантажитиІншийФайлToolStripMenuItem;
private:
/// <summary>
/// Required designer variable.
/// </summary>
System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
void InitializeComponent(void)
{
System::ComponentModel::ComponentResourceManager^ resources = (gcnew System::ComponentModel::ComponentResourceManager(teoria::typeid));
this->richTextBox1 = (gcnew System::Windows::Forms::RichTextBox());
this->menuStrip1 = (gcnew System::Windows::Forms::MenuStrip());
this->вихідToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->завантажитиІншийФайлToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->наГоловнуToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->label1 = (gcnew System::Windows::Forms::Label());
this->menuStrip1->SuspendLayout();
this->SuspendLayout();
//
// richTextBox1
//
this->richTextBox1->Location = System::Drawing::Point(12, 106);
this->richTextBox1->Name = L"richTextBox1";
this->richTextBox1->ReadOnly = true;
this->richTextBox1->ScrollBars = System::Windows::Forms::RichTextBoxScrollBars::Vertical;
this->richTextBox1->Size = System::Drawing::Size(561, 269);
this->richTextBox1->TabIndex = 3;
this->richTextBox1->Text = resources->GetString(L"richTextBox1.Text");
//
// menuStrip1
//
this->menuStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(1) {this->вихідToolStripMenuItem});
this->menuStrip1->Location = System::Drawing::Point(0, 0);
this->menuStrip1->Name = L"menuStrip1";
this->menuStrip1->Size = System::Drawing::Size(585, 24);
this->menuStrip1->TabIndex = 4;
this->menuStrip1->Text = L"menuStrip1";
//
// вихідToolStripMenuItem
//
this->вихідToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(2) {this->завантажитиІншийФайлToolStripMenuItem,
this->наГоловнуToolStripMenuItem});
this->вихідToolStripMenuItem->Name = L"вихідToolStripMenuItem";
this->вихідToolStripMenuItem->Size = System::Drawing::Size(48, 20);
this->вихідToolStripMenuItem->Text = L"Меню";
//
// завантажитиІншийФайлToolStripMenuItem
//
this->завантажитиІншийФайлToolStripMenuItem->Name = L"завантажитиІншийФайлToolStripMenuItem";
this->завантажитиІншийФайлToolStripMenuItem->Size = System::Drawing::Size(213, 22);
this->завантажитиІншийФайлToolStripMenuItem->Text = L"Завантажити інший файл";
this->завантажитиІншийФайлToolStripMenuItem->Click += gcnew System::EventHandler(this, &teoria::завантажитиІншийФайлToolStripMenuItem_Click);
//
// наГоловнуToolStripMenuItem
//
this->наГоловнуToolStripMenuItem->Name = L"наГоловнуToolStripMenuItem";
this->наГоловнуToolStripMenuItem->Size = System::Drawing::Size(213, 22);
this->наГоловнуToolStripMenuItem->Text = L"На головну";
this->наГоловнуToolStripMenuItem->Click += gcnew System::EventHandler(this, &teoria::наГоловнуToolStripMenuItem_Click);
//
// label1
//
this->label1->AutoSize = true;
this->label1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 27.75F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(204)));
this->label1->Location = System::Drawing::Point(18, 41);
this->label1->Name = L"label1";
this->label1->Size = System::Drawing::Size(548, 42);
this->label1->TabIndex = 5;
this->label1->Text = L"Короткі теоретичні відомості";
//
// teoria
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(585, 384);
this->Controls->Add(this->label1);
this->Controls->Add(this->richTextBox1);
this->Controls->Add(this->menuStrip1);
this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::None;
this->MainMenuStrip = this->menuStrip1;
this->Name = L"teoria";
this->menuStrip1->ResumeLayout(false);
this->menuStrip1->PerformLayout();
this->ResumeLayout(false);
this->PerformLayout();
}
#pragma endregion
private: System::Void наГоловнуToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e)
{
Close();
}
private: System::Void завантажитиІншийФайлToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e)
{
OpenFileDialog^ openFile1 = gcnew OpenFileDialog;
openFile1->Filter = "RTF Files|*.txt";
if ( openFile1->ShowDialog() == System::Windows::Forms::DialogResult::OK &&
openFile1->FileName->Length > 0 )
{
richTextBox1->LoadFile( openFile1->FileName, RichTextBoxStreamType::PlainText );
}
}
};
}
about.h
#pragma once
namespace l {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
/// <summary>
/// Summary for about
/// </summary>
public ref class about : public System::Windows::Forms::Form
{
public:
about(void)
{
InitializeComponent();
//
//TODO: Add the constructor code here
//
}
protected:
/// <summary>
/// Clean up any resources being used.
/// </summary>
~about()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::Button^ button1;
protected:
private: System::Windows::Forms::Label^ label1;
private: System::Windows::Forms::Label^ label2;
private: System::Windows::Forms::Label^ label3;
private: System::Windows::Forms::Label^ label4;
private: System::Windows::Forms::Label^ label5;
private: System::Windows::Forms::Label^ label6;
private: System::Windows::Forms::Label^ label7;
private: System::Windows::Forms::Label^ label8;
private:
/// <summary>
/// Required designer variable.
/// </summary>
System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
void InitializeComponent(void)
{
System::ComponentModel::ComponentResourceManager^ resources = (gcnew System::ComponentModel::ComponentResourceManager(about::typeid));
this->button1 = (gcnew System::Windows::Forms::Button());
this->label1 = (gcnew System::Windows::Forms::Label());
this->label2 = (gcnew System::Windows::Forms::Label());
this->label3 = (gcnew System::Windows::Forms::Label());
this->label4 = (gcnew System::Windows::Forms::Label());
this->label5 = (gcnew System::Windows::Forms::Label());
this->label6 = (gcnew System::Windows::Forms::Label());
this->label7 = (gcnew System::Windows::Forms::Label());
this->label8 = (gcnew System::Windows::Forms::Label());
this->SuspendLayout();
//
// button1
//
this->button1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 20, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(204)));
this->button1->Location = System::Drawing::Point(160, 477);
this->button1->Name = L"button1";
this->button1->Size = System::Drawing::Size(112, 40);
this->button1->TabIndex = 0;
this->button1->Text = L"Ок";
this->button1->UseVisualStyleBackColor = true;
this->button1->Click += gcnew System::EventHandler(this, &about::button1_Click);
//
// label1
//
this->label1->AutoSize = true;
this->label1->Font = (gcnew System::Drawing::Font(L"Comic Sans MS", 35.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(0)));
this->label1->ForeColor = System::Drawing::Color::RosyBrown;
this->label1->Location = System::Drawing::Point(32, 21);
this->label1->Name = L"label1";
this->label1->Size = System::Drawing::Size(385, 65);
this->label1->TabIndex = 1;
this->label1->Text = L"Курсова робота";
//
// label2
//
this->label2->AutoSize = true;
this->label2->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 30, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(204)));
this->label2->ForeColor = System::Drawing::Color::MediumPurple;
this->label2->Location = System::Drawing::Point(108, 112);
this->label2->Name = L"label2";
this->label2->Size = System::Drawing::Size(190, 46);
this->label2->TabIndex = 2;
this->label2->Text = L"На тему:";
//
// label3
//
this->label3->AutoSize = true;
this->label3->Font = (gcnew System::Drawing::Font(L"Monotype Corsiva", 21.75F, System::Drawing::FontStyle::Italic, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(204)));
this->label3->ForeColor = System::Drawing::Color::OrangeRed;
this->label3->Location = System::Drawing::Point(12, 178);
this->label3->Name = L"label3";
this->label3->Size = System::Drawing::Size(427, 36);
this->label3->TabIndex = 3;
this->label3->Text = L"\"Демонстрація роботи черги і списку\"";
//
// label4
//
this->label4->AutoSize = true;
this->label4->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 18, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(204)));
this->label4->Location = System::Drawing::Point(28, 279);
this->label4->Name = L"label4";
this->label4->Size = System::Drawing::Size(379, 29);
this->label4->TabIndex = 4;
this->label4->Text = L"Виконав студент групи ПР-91";
//
// label5
//
this->label5->AutoSize = true;
this->label5->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 15.75F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(204)));
this->label5->Location = System::Drawing::Point(28, 318);
this->label5->Name = L"label5";
this->label5->Size = System::Drawing::Size(331, 25);
this->label5->TabIndex = 5;
this->label5->Text = L"Нічепорук Юрій Олександрович";
//
// label6
//
this->label6->AutoSize = true;
this->label6->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 18, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(204)));
this->label6->Location = System::Drawing::Point(28, 374);
this->label6->Name = L"label6";
this->label6->Size = System::Drawing::Size(344, 29);
this->label6->TabIndex = 6;
this->label6->Text = L"На замовлення викладача";
//
// label7
//
this->label7->AutoSize = true;
this->label7->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 15.75F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(204)));
this->label7->Location = System::Drawing::Point(28, 414);
this->label7->Name = L"label7";
this->label7->Size = System::Drawing::Size(372, 25);
this->label7->TabIndex = 7;
this->label7->Text = L"Григоровського Євгена Сергійовича";
//
// label8
//
this->label8->AutoSize = true;
this->label8->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 12.75F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(204)));
this->label8->Location = System::Drawing::Point(17, 230);
this->label8->Name = L"label8";
this->label8->Size = System::Drawing::Size(422, 20);
this->label8->TabIndex = 8;
this->label8->Text = L"По предмету \"Алгоритми і структури даних\"";
//
// about
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->BackgroundImage = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"$this.BackgroundImage")));
this->BackgroundImageLayout = System::Windows::Forms::ImageLayout::Stretch;
this->ClientSize = System::Drawing::Size(448, 529);
this->Controls->Add(this->label8);
this->Controls->Add(this->label7);
this->Controls->Add(this->label6);
this->Controls->Add(this->label5);
this->Controls->Add(this->label4);
this->Controls->Add(this->label3);
this->Controls->Add(this->label2);
this->Controls->Add(this->label1);
this->Controls->Add(this->button1);
this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::None;
this->Name = L"about";
this->ResumeLayout(false);
this->PerformLayout();
}
#pragma endregion
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
Close();
}
};
}