Documente Academic
Documente Profesional
Documente Cultură
ARBORI C++
LUCRARE PENTRU ATESTAREA COMPETENŢELOR
PROFESIONALE
Argument......................................................................1
Noțiuni teoretice...........................................................2
Grafuri neorientate...............................................2
Arbori....................................................................3
Prezentarea proiectului................................................7
Sursa............................................................................14
Bibliografie...................................................................34
Argument
1
Noțiuni teoretice
Grafuri neorientate
Conform definiției:
Teoremă: Într-un graf neorientat, suma gradelor tuturor vârfurilor este dublul
numărului de muchii.
2
Observații:
Consecințe:
Definiție: Un graf neorientat se numește graf conex dacă pentru oricare două
vârfuri x și y diferite ale sale, există cel puțin un lanț care le leagă, adică x este
extremitatea inițială și y este extremitatea finală.
3
Arbori
Exemplu:
Observații:
4
Prezentarea proiectului
Mediu de învățare
5
6
7
o Joc
8
o Răspuns corect
o Răspuns greșit
9
Test
10
11
Sursa
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApp1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
DoubleBuffered = true;
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApp1
{
public partial class Form2 : Form
12
{
public Form2()
{
InitializeComponent();
}
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApp1
{
public partial class Form3 : Form
{
public Form3()
{
InitializeComponent();
}
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApp1
{
public partial class exnerez : Form
13
{
public exnerez()
{
InitializeComponent();
}
namespace WindowsFormsApp1
{
public partial class exrez : UserControl
{
public exrez()
{
InitializeComponent();
}
namespace WindowsFormsApp1
{
public partial class exrezo : Form
14
{
public exrezo()
{
InitializeComponent();
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApp1
{
public partial class final : Form
{
public final()
{
InitializeComponent();
}
namespace WindowsFormsApp1
{
public partial class intr1 : Form
{
public intr1()
{
InitializeComponent();
}
15
private void button1_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.OK;
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApp1
{
public partial class intr2 : Form
{
public intr2()
{
InitializeComponent();
}
namespace WindowsFormsApp1
{
public partial class intr3 : Form
{
public intr3()
{
InitializeComponent();
}
16
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApp1
{
public partial class intr4 : Form
{
public intr4()
{
InitializeComponent();
}
namespace WindowsFormsApp1
{
public partial class intr5 : Form
{
public intr5()
{
InitializeComponent();
}
namespace WindowsFormsApp1
{
public partial class joc : Form
{
public int scor = 0;
int nr=0;
int sus, sus2,sus3,sus4,sus5;
17
int st, st2, st3, st4, st5;
public joc()
{
InitializeComponent();
DoubleBuffered = true;
sus = button1.Top;
st = button1.Left-45;
sus2 = button2.Top;
st2 = button2.Left-45;
sus3 = button3.Top;
st3 = button3.Left-45;
sus4 = button4.Top;
st4 = button4.Left-45;
sus5 = button5.Top;
st5 = button5.Left - 45;
}
string rezultat;
private void button4_Click(object sender, EventArgs e)
{
button4.Enabled = false;
nr++;
intr4 in4 = new intr4();
if (in4.ShowDialog(this) == DialogResult.OK)
{
this.rezultat = in4.textBox1.Text;
if (rezultat.Equals("1"))
{
MessageBox.Show("Raspuns corect!");
scor++;
timer4.Start();
}
else
{
MessageBox.Show("Raspuns gresit!");
Image poza = new Bitmap(@"C:\Users\roxi\Pictures\stricat.png");
button4.BackgroundImage = poza;
}
}
in4.Dispose();
if (nr==5)
{
final fin = new final();
if(scor==1)
fin.label1.Text = "Felicitari! Ai obtinut: " + scor + " punct!";
else
fin.label1.Text = "Felicitari! Ai obtinut: " + scor + " puncte!";
fin.Show();
}
}
private void timer4_Tick(object sender, EventArgs e)
{
cos.Visible = true;
cos.Left = st4;
cos.Top = 400;
if (sus4 < 300) { sus4 += 6; button4.Top = sus4; }
else
if (sus4 < 425)
{
sus4 += 8;
button4.Top = sus4;
}
if (sus4 >= 435)
18
{
timer4.Stop();
cos.Visible = false;
button4.Visible = false;
}
else if (sus4 >= 425) sus4 += 5;
}
19
private void button1_Click(object sender, EventArgs e)
{
button1.Enabled = false;
nr++;
intr1 in1 = new intr1();
if(in1.ShowDialog(this)==DialogResult.OK)
{
this.rezultat = in1.textBox1.Text;
if (rezultat.Equals("2"))
{
MessageBox.Show("Raspuns corect!");
scor++;
timer1.Start();
}
else
{
MessageBox.Show("Raspuns gresit!");
Image poza = new Bitmap(@"C:\Users\roxi\Pictures\stricat.png");
button1.BackgroundImage = poza;
}
}
in1.Dispose();
if (nr == 5)
{
final fin = new final();
if (scor == 1)
fin.label1.Text = "Felicitari! Ai obtinut: " + scor + " punct!";
else
fin.label1.Text = "Felicitari! Ai obtinut: " + scor + " puncte!";
fin.Show();
}
}
20
this.rezultat2 = in2.textBox1.Text;
if (rezultat2.Equals("19"))
{
MessageBox.Show("Raspuns corect!");
scor++;
timer2.Start();
}
else
{
MessageBox.Show("Raspuns gresit!");
Image poza = new Bitmap(@"C:\Users\roxi\Pictures\stricat.png");
button2.BackgroundImage = poza;
}
}
in2.Dispose();
if (nr == 5)
{
final fin = new final();
if (scor == 1)
fin.label1.Text = "Felicitari! Ai obtinut: " + scor + " punct!";
else
fin.label1.Text = "Felicitari! Ai obtinut: " + scor + " puncte!";
fin.Show();
}
}
string rezultat3;
private void button3_Click(object sender, EventArgs e)
{
button3.Enabled = false;
nr++;
intr3 in3 = new intr3();
if (in3.ShowDialog(this) == DialogResult.OK)
{
this.rezultat3 = in3.textBox1.Text;
if (rezultat3.Equals("171"))
{
MessageBox.Show("Raspuns corect!");
scor++;
timer3.Start();
}
else
{
MessageBox.Show("Raspuns gresit!");
Image poza = new Bitmap(@"C:\Users\roxi\Pictures\stricat.png");
button3.BackgroundImage = poza;
}
}
in3.Dispose();
if (nr == 5)
{
final fin = new final();
if (scor == 1)
fin.label1.Text = "Felicitari! Ai obtinut: " + scor + " punct!";
else
fin.label1.Text = "Felicitari! Ai obtinut: " + scor + " puncte!";
fin.Show();
}
}
21
cos.Left = st3;
cos.Top = 400;
if (sus3 < 300) { sus3 += 5; button3.Top = sus3; }
else
if (sus3 < 380)
{
sus3 += 8;
button3.Top = sus3;
}
else if (sus3 < 425)
{
sus3 += 11;
button3.Top = sus3;
}
if (sus3 >= 435)
{
timer3.Stop();
cos.Visible = false;
button3.Visible = false;
}
else if (sus3 >= 425) sus3 += 5;
}
namespace WindowsFormsApp1
{
22
public partial class teorie : UserControl
{
public teorie()
{
InitializeComponent();
DoubleBuffered = true;
}
23
namespace WindowsFormsApp1
{
public partial class teorie1 : UserControl
{
public teorie1()
{
InitializeComponent();
DoubleBuffered = true;
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApp1
{
public partial class teorie2 : UserControl
{
public teorie2()
{
InitializeComponent();
DoubleBuffered = true;
}
private void teorie2_Load(object sender, EventArgs e)
{
DoubleBuffered = true;
}
private void n1_Click(object sender, EventArgs e)
{
pictureBox2.Visible = true;
DoubleBuffered = true;
}
24
DoubleBuffered = true;
}
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
25
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace WindowsFormsApp1
{
public partial class test2 : UserControl
{
public test2()
{
InitializeComponent();
}
26
"gradul maxim este 4, " +
"iar gradul minim este 1","gradul maxim este 3, " +
"iar gradul minim este 1","gradul maxim este 3, " +
"iar gradul minim este 2","gradul maxim este 4 iar " +
"gradul minim este 2",
"5","10","20","6",
"nu are niciun fiu","este legat direct de radacina","se afla pe nivelul
2"," are doar un fiu",
"2,4,1","2,5","2,3","2,4",
"10","11","12","9"
};
string ans;
int i = -1;
int a = 0;
int scor = 0;
private void start_Click(object sender, EventArgs e)
{
pictureBox1.Visible = false;
label1.Visible = true;
ok.Visible = true;
ok2.Visible = true;
ok3.Visible = true;
ok4.Visible = true;
raspunde.Visible = true;
label3.Visible = true;
if (i < intr.Length-1)
i++;
label1.Text = intr[i];
label3.Text = Convert.ToString(i+1)+"/10";
ok.Text = rasp[a];
a++;
ok2.Text = rasp[a];
a++;
ok3.Text = rasp[a];
a++;
ok4.Text = rasp[a];
a++;
start.Visible = false;
if (i == 9)
{ button1.Visible = true; }
}
string getSelectedAnswer()
{
if (ok.Checked)
return ok.Text.ToString();
if (ok2.Checked)
return ok2.Text.ToString();
if (ok3.Checked)
return ok3.Text.ToString();
if (ok4.Checked)
return ok4.Text.ToString();
return "";
}
27
con.Open();
cmd.ExecuteNonQuery();
con.Close();
MessageBox.Show("Raspuns inregistrat!");
SqlCommand cmd1 = new SqlCommand("SELECT [raspunsuri].[raspuns],
[rcorecte].[rcorect] FROM [rcorecte] INNER JOIN ( SELECT TOP 1 [raspuns] FROM
[raspunsuri] order by ID DESC) AS [raspunsuri] ON [raspunsuri].[raspuns]=[rcorecte].
[rcorect]", con);
SqlDataAdapter sda1 = new SqlDataAdapter(cmd1);
DataTable dt = new DataTable();
sda1.Fill(dt);
if (dt.Rows.Count > 0)
{
SqlCommand cmd2 = new SqlCommand(@"INSERT INTO [intrebari]
([intrebare]) values('corect') ", con);
con.Open();
cmd2.ExecuteNonQuery();
con.Close();
scor++;
}
else
{
SqlCommand cmd2 = new SqlCommand(@"INSERT INTO [intrebari]
([intrebare]) values('incorect') ", con);
con.Open();
cmd2.ExecuteNonQuery();
con.Close();
}
if (i == 9) start.Visible = false;
else
{
start.Visible = true;
start.Text = "Next";
}
28
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace WindowsFormsApp1
{
public partial class UserControl1 : UserControl
{
public UserControl1()
{
InitializeComponent();
}
29
da.Fill(dt);
dataGridView1.DataSource = dt;
con.Close();
}
30
Resurse de hard şi soft necesare
31
Bibliografia
https://www.pbinfo.ro/
http://ase.softmentor.ro/StructuriDeDate/06_Arbori.htm
https://invata.info/2017/04/02/arbori-c/
32