-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathForm1.cs
116 lines (87 loc) · 3.93 KB
/
Form1.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
namespace ForeacH_Examples
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
List<int> numbers = new List<int>();
private void Form1_Load(object sender, EventArgs e)
{
numbers.Add(186);
numbers.Add(24);
numbers.Add(32);
numbers.Add(245);
numbers.Add(96);
numbers.Add(1907);
numbers.Add(1881);
}
private void btnNewNumber_Click_1(object sender, EventArgs e)
{
//Let's add a new number to the numbers in the list we created earlier and add them.//
int newnumber = Convert.ToInt32(textNewNumber.Text);
numbers.Add(newnumber);
int total = 0;
foreach (int number in numbers)
{
total = total + number;
}
MessageBox.Show($"The sum of the numbers in the list before the new number is entered: {(total - newnumber)}" +
$"\nThe sum of the numbers in the list with the newly entered number : {total}");
}
private void Examples1_Click(object sender, EventArgs e)
{
//Let's sort the teams in the nba east conference A-Z and print them in the listbox.//
string[] NbaEasternConference = {"Chicago Bulls", "Miami Heat", "Brooklyn Heat", "Cleveland Cavaliers","Milwaukee Bucks", "Philadelphia 76ers","Charlotte Hornets",
"Washington Wizards","Toronto Raaptors","Boston Celtics","New York Knicks","Atalanta Hawks",
"Indiana PACERS","Detroit Pistons","Orlando Magic"};
Array.Sort(NbaEasternConference);
foreach (string teams in NbaEasternConference)
{
listBox1.Items.Add(teams);
}
}
private void Examples2_Click(object sender, EventArgs e)
{
//Let's sort the teams in the nba east conference Z-A and print them in the listbox.//
string[] NbaEasternConference = {"Chicago Bulls", "Miami Heat", "Brooklyn Heat", "Cleveland Cavaliers","Milwaukee Bucks",
"Philadelphia 76ers","Charlotte Hornets",
"Washington Wizards","Toronto Raaptors","Boston Celtics","New York Knicks","Atalanta Hawks",
"Indiana Pacers","Detroit Pistons","Orlando Magic"};
Array.Reverse(NbaEasternConference);
foreach (string teams in NbaEasternConference)
{
listBox1.Items.Add(teams);
}
}
private void Examples3_Click(object sender, EventArgs e)
{
//Querying the end-of-term student status document according to the grades in the given list.
int[] points = { 86, 75, 90, 100, 80, 64, 50, 92, 100, 87 };
int average = 0;
int total = 0;
foreach (int point in points)
{
listBox1.Items.Add(point);
total = point + total;
average = total / points.Length;
}
if(average >= 85 )
{
listBox1.Items.Add($"Not Ortalamanýz: {average}");
listBox1.Items.Add($" Takdir belgesi almaya hak kazandýnýz.");
}
else if (average >= 70 && average < 85 )
{
listBox1.Items.Add($"Not Ortalamanýz: {average}");
listBox1.Items.Add($"Teþekkür belgesi almaya hak kazandýnýz.");
}
else
{
listBox1.Items.Add($"Not Ortalamanýz: {average}");
listBox1.Items.Add($"Üzgünüm.Belge hakký kazanamadýnýz.");
}
}
}
}