From 4872467c160b9a9be567e984e7f653777c32c8c1 Mon Sep 17 00:00:00 2001
From: 600612155 <35395357+teamhd35975@users.noreply.github.com>
Date: Fri, 17 Aug 2018 16:20:33 +0700
Subject: [PATCH 1/2] =?UTF-8?q?=E0=B8=AA=E0=B8=A7=E0=B8=B1=E0=B8=AA?=
=?UTF-8?q?=E0=B8=94=E0=B8=B5=E0=B8=84=E0=B8=A3=E0=B8=B1=E0=B8=9A?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
CPE200Lab1/CPE200Lab1/CPE200Lab1.csproj | 10 +-
CPE200Lab1/CPE200Lab1/Form1.Designer.cs | 18 +++
CPE200Lab1/CPE200Lab1/Form1.cs | 164 ++++++++++++++++++++++++
3 files changed, 187 insertions(+), 5 deletions(-)
diff --git a/CPE200Lab1/CPE200Lab1/CPE200Lab1.csproj b/CPE200Lab1/CPE200Lab1/CPE200Lab1.csproj
index 29fa142f..8ef0b85b 100644
--- a/CPE200Lab1/CPE200Lab1/CPE200Lab1.csproj
+++ b/CPE200Lab1/CPE200Lab1/CPE200Lab1.csproj
@@ -45,16 +45,16 @@
-
+
Form
-
- Form1.cs
+
+ work1.cs
-
- Form1.cs
+
+ work1.cs
ResXFileCodeGenerator
diff --git a/CPE200Lab1/CPE200Lab1/Form1.Designer.cs b/CPE200Lab1/CPE200Lab1/Form1.Designer.cs
index ab4b44a3..e9f4491e 100644
--- a/CPE200Lab1/CPE200Lab1/Form1.Designer.cs
+++ b/CPE200Lab1/CPE200Lab1/Form1.Designer.cs
@@ -60,6 +60,7 @@ private void InitializeComponent()
this.btn7.TabIndex = 0;
this.btn7.Text = "7";
this.btn7.UseVisualStyleBackColor = true;
+ this.btn7.Click += new System.EventHandler(this.btn7_Click);
//
// btn8
//
@@ -70,6 +71,7 @@ private void InitializeComponent()
this.btn8.TabIndex = 1;
this.btn8.Text = "8";
this.btn8.UseVisualStyleBackColor = true;
+ this.btn8.Click += new System.EventHandler(this.btn8_Click);
//
// btn9
//
@@ -80,6 +82,7 @@ private void InitializeComponent()
this.btn9.TabIndex = 2;
this.btn9.Text = "9";
this.btn9.UseVisualStyleBackColor = true;
+ this.btn9.Click += new System.EventHandler(this.btn9_Click);
//
// btnMultiply
//
@@ -90,6 +93,7 @@ private void InitializeComponent()
this.btnMultiply.TabIndex = 3;
this.btnMultiply.Text = "X";
this.btnMultiply.UseVisualStyleBackColor = true;
+ this.btnMultiply.Click += new System.EventHandler(this.btnMultiply_Click);
//
// btnMinus
//
@@ -100,6 +104,7 @@ private void InitializeComponent()
this.btnMinus.TabIndex = 7;
this.btnMinus.Text = "-";
this.btnMinus.UseVisualStyleBackColor = true;
+ this.btnMinus.Click += new System.EventHandler(this.btnMinus_Click);
//
// btn6
//
@@ -110,6 +115,7 @@ private void InitializeComponent()
this.btn6.TabIndex = 6;
this.btn6.Text = "6";
this.btn6.UseVisualStyleBackColor = true;
+ this.btn6.Click += new System.EventHandler(this.btn6_Click);
//
// btn5
//
@@ -120,6 +126,7 @@ private void InitializeComponent()
this.btn5.TabIndex = 5;
this.btn5.Text = "5";
this.btn5.UseVisualStyleBackColor = true;
+ this.btn5.Click += new System.EventHandler(this.btn5_Click);
//
// btn4
//
@@ -130,6 +137,7 @@ private void InitializeComponent()
this.btn4.TabIndex = 4;
this.btn4.Text = "4";
this.btn4.UseVisualStyleBackColor = true;
+ this.btn4.Click += new System.EventHandler(this.btn4_Click);
//
// btnPlus
//
@@ -140,6 +148,7 @@ private void InitializeComponent()
this.btnPlus.TabIndex = 11;
this.btnPlus.Text = "+";
this.btnPlus.UseVisualStyleBackColor = true;
+ this.btnPlus.Click += new System.EventHandler(this.btnPlus_Click);
//
// btn3
//
@@ -150,6 +159,7 @@ private void InitializeComponent()
this.btn3.TabIndex = 10;
this.btn3.Text = "3";
this.btn3.UseVisualStyleBackColor = true;
+ this.btn3.Click += new System.EventHandler(this.btn3_Click);
//
// btn2
//
@@ -160,6 +170,7 @@ private void InitializeComponent()
this.btn2.TabIndex = 9;
this.btn2.Text = "2";
this.btn2.UseVisualStyleBackColor = true;
+ this.btn2.Click += new System.EventHandler(this.btn2_Click);
//
// btn1
//
@@ -170,6 +181,7 @@ private void InitializeComponent()
this.btn1.TabIndex = 8;
this.btn1.Text = "1";
this.btn1.UseVisualStyleBackColor = true;
+ this.btn1.Click += new System.EventHandler(this.btn1_Click);
//
// btnEqual
//
@@ -180,6 +192,7 @@ private void InitializeComponent()
this.btnEqual.TabIndex = 15;
this.btnEqual.Text = "=";
this.btnEqual.UseVisualStyleBackColor = true;
+ this.btnEqual.Click += new System.EventHandler(this.btnEqual_Click);
//
// btnDot
//
@@ -190,6 +203,7 @@ private void InitializeComponent()
this.btnDot.TabIndex = 14;
this.btnDot.Text = ".";
this.btnDot.UseVisualStyleBackColor = true;
+ this.btnDot.Click += new System.EventHandler(this.btnDot_Click);
//
// btn0
//
@@ -200,6 +214,7 @@ private void InitializeComponent()
this.btn0.TabIndex = 13;
this.btn0.Text = "0";
this.btn0.UseVisualStyleBackColor = true;
+ this.btn0.Click += new System.EventHandler(this.btn0_Click);
//
// btnSign
//
@@ -220,6 +235,7 @@ private void InitializeComponent()
this.btnDivide.TabIndex = 16;
this.btnDivide.Text = "÷";
this.btnDivide.UseVisualStyleBackColor = true;
+ this.btnDivide.Click += new System.EventHandler(this.btnDivide_Click);
//
// btnPercent
//
@@ -240,6 +256,7 @@ private void InitializeComponent()
this.btnClear.TabIndex = 18;
this.btnClear.Text = "C";
this.btnClear.UseVisualStyleBackColor = true;
+ this.btnClear.Click += new System.EventHandler(this.btnClear_Click);
//
// btnBack
//
@@ -263,6 +280,7 @@ private void InitializeComponent()
this.lblDisplay.TabIndex = 20;
this.lblDisplay.Text = "0";
this.lblDisplay.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+ this.lblDisplay.Click += new System.EventHandler(this.lblDisplay_Click);
//
// Form1
//
diff --git a/CPE200Lab1/CPE200Lab1/Form1.cs b/CPE200Lab1/CPE200Lab1/Form1.cs
index d98de493..cffa9024 100644
--- a/CPE200Lab1/CPE200Lab1/Form1.cs
+++ b/CPE200Lab1/CPE200Lab1/Form1.cs
@@ -12,9 +12,173 @@ namespace CPE200Lab1
{
public partial class Form1 : Form
{
+ private int val = 0;
+ private int sum;
+ private int i;
+ private string
+
+
+
+
+
+
+
+
+
public Form1()
{
InitializeComponent();
+ }
+
+ private void btnClear_Click(object sender, EventArgs e)
+ {
+ val = val * 0;
+ lblDisplay.Text = val.ToString();
+ }
+
+ private void btn1_Click(object sender, EventArgs e)
+ {
+ val = val * 10 + 1;
+ lblDisplay.Text = val.ToString();
+
+ }
+
+ private void lblDisplay_Click(object sender, EventArgs e)
+ {
+
+ }
+
+ private void btn2_Click(object sender, EventArgs e)
+ {
+ val = val * 10 + 2;
+ lblDisplay.Text = val.ToString();
+ }
+
+ private void btn3_Click(object sender, EventArgs e)
+ {
+ val = val * 10 + 3;
+ lblDisplay.Text = val.ToString();
+ }
+
+ private void btn4_Click(object sender, EventArgs e)
+ {
+ val = val * 10 + 4;
+ lblDisplay.Text = val.ToString();
+ }
+
+ private void btn5_Click(object sender, EventArgs e)
+ {
+ val = val * 10 + 5;
+ lblDisplay.Text = val.ToString();
+ }
+
+ private void btn6_Click(object sender, EventArgs e)
+ {
+ val = val * 10 + 6;
+ lblDisplay.Text = val.ToString();
+ }
+
+ private void btn7_Click(object sender, EventArgs e)
+ {
+ val = val * 10 + 7;
+ lblDisplay.Text = val.ToString();
+ }
+
+ private void btn8_Click(object sender, EventArgs e)
+ {
+ val = val * 10 + 8;
+ lblDisplay.Text = val.ToString();
+ }
+
+ private void btn9_Click(object sender, EventArgs e)
+ {
+ val = val * 10 + 9;
+ lblDisplay.Text = val.ToString();
+ }
+
+ private void btn0_Click(object sender, EventArgs e)
+ {
+ val = val * 10 + 0;
+ lblDisplay.Text = val.ToString();
+ }
+
+ private void btnPlus_Click(object sender, EventArgs e)
+ {
+
+ sum = Convert.ToInt32(lblDisplay.Text);
+ lblDisplay.Text = Convert.ToString(sum);
+ val = val * 0;
+ i = 1;
+
+
+
+ }
+
+ private void btnMinus_Click(object sender, EventArgs e)
+ {
+ sum = Convert.ToInt32(lblDisplay.Text);
+ lblDisplay.Text = Convert.ToString(sum);
+ val = val * 0;
+ i = 2;
+ }
+
+ private void btnMultiply_Click(object sender, EventArgs e)
+ {
+ sum = Convert.ToInt32(lblDisplay.Text);
+ lblDisplay.Text = Convert.ToString(sum);
+ val = val * 0;
+ i = 3;
+ }
+
+ private void btnDivide_Click(object sender, EventArgs e)
+ {
+
+ sum = Convert.ToInt32(lblDisplay.Text);
+ lblDisplay.Text = Convert.ToString(sum);
+ val = val * 0;
+ i = 4;
+
+ }
+
+ private void btnDot_Click(object sender, EventArgs e)
+ {
+ val = val + ".";
+ lblDisplay.Text = val.ToString();
+ }
+
+
+
+
+ private void btnEqual_Click(object sender, EventArgs e)
+ {
+ if (i == 1)
+ {
+ val = val + sum;
+ lblDisplay.Text = val.ToString();
+
+ }
+ if (i == 2)
+ {
+ val = val - sum;
+ lblDisplay.Text = val.ToString();
+ }
+ if (i == 3)
+ {
+ val = val * sum;
+ lblDisplay.Text = val.ToString();
+
+ }
+ if (i == 4)
+ {
+ val = val / sum;
+ lblDisplay.Text = val.ToString();
+ }
+
+
+
+
+
+
}
}
}
From a3246f5a135bf9bcb92cbf6d031d5e59e70e1927 Mon Sep 17 00:00:00 2001
From: 600612155 <35395357+600612155@users.noreply.github.com>
Date: Fri, 31 Aug 2018 17:20:41 +0700
Subject: [PATCH 2/2] =?UTF-8?q?=E0=B9=80=E0=B9=80=E0=B8=A5=E0=B8=9B=200?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
CPE200Lab1/CPE200Lab1/work1.Designer.cs | 345 ++++++++++++++++++++++++
CPE200Lab1/CPE200Lab1/work1.cs | 256 ++++++++++++++++++
CPE200Lab1/CPE200Lab1/work1.resx | 120 +++++++++
3 files changed, 721 insertions(+)
create mode 100644 CPE200Lab1/CPE200Lab1/work1.Designer.cs
create mode 100644 CPE200Lab1/CPE200Lab1/work1.cs
create mode 100644 CPE200Lab1/CPE200Lab1/work1.resx
diff --git a/CPE200Lab1/CPE200Lab1/work1.Designer.cs b/CPE200Lab1/CPE200Lab1/work1.Designer.cs
new file mode 100644
index 00000000..7d93f598
--- /dev/null
+++ b/CPE200Lab1/CPE200Lab1/work1.Designer.cs
@@ -0,0 +1,345 @@
+namespace CPE200Lab1
+{
+ partial class Form1
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.btn7 = new System.Windows.Forms.Button();
+ this.btn8 = new System.Windows.Forms.Button();
+ this.btn9 = new System.Windows.Forms.Button();
+ this.btnMultiply = new System.Windows.Forms.Button();
+ this.btnMinus = new System.Windows.Forms.Button();
+ this.btn6 = new System.Windows.Forms.Button();
+ this.btn5 = new System.Windows.Forms.Button();
+ this.btn4 = new System.Windows.Forms.Button();
+ this.btnPlus = new System.Windows.Forms.Button();
+ this.btn3 = new System.Windows.Forms.Button();
+ this.btn2 = new System.Windows.Forms.Button();
+ this.btn1 = new System.Windows.Forms.Button();
+ this.btnEqual = new System.Windows.Forms.Button();
+ this.btnDot = new System.Windows.Forms.Button();
+ this.btn0 = new System.Windows.Forms.Button();
+ this.btnSign = new System.Windows.Forms.Button();
+ this.btnDivide = new System.Windows.Forms.Button();
+ this.btnPercent = new System.Windows.Forms.Button();
+ this.btnClear = new System.Windows.Forms.Button();
+ this.btnBack = new System.Windows.Forms.Button();
+ this.lblDisplay = new System.Windows.Forms.Label();
+ this.SuspendLayout();
+ //
+ // btn7
+ //
+ this.btn7.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.btn7.Location = new System.Drawing.Point(12, 218);
+ this.btn7.Name = "btn7";
+ this.btn7.Size = new System.Drawing.Size(88, 64);
+ this.btn7.TabIndex = 0;
+ this.btn7.Text = "7";
+ this.btn7.UseVisualStyleBackColor = true;
+ this.btn7.Click += new System.EventHandler(this.btn7_Click);
+ //
+ // btn8
+ //
+ this.btn8.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.btn8.Location = new System.Drawing.Point(106, 218);
+ this.btn8.Name = "btn8";
+ this.btn8.Size = new System.Drawing.Size(88, 64);
+ this.btn8.TabIndex = 1;
+ this.btn8.Text = "8";
+ this.btn8.UseVisualStyleBackColor = true;
+ this.btn8.Click += new System.EventHandler(this.btn8_Click);
+ //
+ // btn9
+ //
+ this.btn9.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.btn9.Location = new System.Drawing.Point(200, 218);
+ this.btn9.Name = "btn9";
+ this.btn9.Size = new System.Drawing.Size(88, 64);
+ this.btn9.TabIndex = 2;
+ this.btn9.Text = "9";
+ this.btn9.UseVisualStyleBackColor = true;
+ this.btn9.Click += new System.EventHandler(this.btn9_Click);
+ //
+ // btnMultiply
+ //
+ this.btnMultiply.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.btnMultiply.Location = new System.Drawing.Point(294, 218);
+ this.btnMultiply.Name = "btnMultiply";
+ this.btnMultiply.Size = new System.Drawing.Size(88, 64);
+ this.btnMultiply.TabIndex = 3;
+ this.btnMultiply.Text = "X";
+ this.btnMultiply.UseVisualStyleBackColor = true;
+ this.btnMultiply.Click += new System.EventHandler(this.btnMultiply_Click);
+ //
+ // btnMinus
+ //
+ this.btnMinus.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.btnMinus.Location = new System.Drawing.Point(294, 288);
+ this.btnMinus.Name = "btnMinus";
+ this.btnMinus.Size = new System.Drawing.Size(88, 64);
+ this.btnMinus.TabIndex = 7;
+ this.btnMinus.Text = "-";
+ this.btnMinus.UseVisualStyleBackColor = true;
+ this.btnMinus.Click += new System.EventHandler(this.btnMinus_Click);
+ //
+ // btn6
+ //
+ this.btn6.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.btn6.Location = new System.Drawing.Point(200, 288);
+ this.btn6.Name = "btn6";
+ this.btn6.Size = new System.Drawing.Size(88, 64);
+ this.btn6.TabIndex = 6;
+ this.btn6.Text = "6";
+ this.btn6.UseVisualStyleBackColor = true;
+ this.btn6.Click += new System.EventHandler(this.btn6_Click);
+ //
+ // btn5
+ //
+ this.btn5.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.btn5.Location = new System.Drawing.Point(106, 288);
+ this.btn5.Name = "btn5";
+ this.btn5.Size = new System.Drawing.Size(88, 64);
+ this.btn5.TabIndex = 5;
+ this.btn5.Text = "5";
+ this.btn5.UseVisualStyleBackColor = true;
+ this.btn5.Click += new System.EventHandler(this.btn5_Click);
+ //
+ // btn4
+ //
+ this.btn4.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.btn4.Location = new System.Drawing.Point(12, 288);
+ this.btn4.Name = "btn4";
+ this.btn4.Size = new System.Drawing.Size(88, 64);
+ this.btn4.TabIndex = 4;
+ this.btn4.Text = "4";
+ this.btn4.UseVisualStyleBackColor = true;
+ this.btn4.Click += new System.EventHandler(this.btn4_Click);
+ //
+ // btnPlus
+ //
+ this.btnPlus.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.btnPlus.Location = new System.Drawing.Point(294, 358);
+ this.btnPlus.Name = "btnPlus";
+ this.btnPlus.Size = new System.Drawing.Size(88, 64);
+ this.btnPlus.TabIndex = 11;
+ this.btnPlus.Text = "+";
+ this.btnPlus.UseVisualStyleBackColor = true;
+ this.btnPlus.Click += new System.EventHandler(this.btnPlus_Click);
+ //
+ // btn3
+ //
+ this.btn3.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.btn3.Location = new System.Drawing.Point(200, 358);
+ this.btn3.Name = "btn3";
+ this.btn3.Size = new System.Drawing.Size(88, 64);
+ this.btn3.TabIndex = 10;
+ this.btn3.Text = "3";
+ this.btn3.UseVisualStyleBackColor = true;
+ this.btn3.Click += new System.EventHandler(this.btn3_Click);
+ //
+ // btn2
+ //
+ this.btn2.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.btn2.Location = new System.Drawing.Point(106, 358);
+ this.btn2.Name = "btn2";
+ this.btn2.Size = new System.Drawing.Size(88, 64);
+ this.btn2.TabIndex = 9;
+ this.btn2.Text = "2";
+ this.btn2.UseVisualStyleBackColor = true;
+ this.btn2.Click += new System.EventHandler(this.btn2_Click);
+ //
+ // btn1
+ //
+ this.btn1.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.btn1.Location = new System.Drawing.Point(12, 358);
+ this.btn1.Name = "btn1";
+ this.btn1.Size = new System.Drawing.Size(88, 64);
+ this.btn1.TabIndex = 8;
+ this.btn1.Text = "1";
+ this.btn1.UseVisualStyleBackColor = true;
+ this.btn1.Click += new System.EventHandler(this.btn1_Click);
+ //
+ // btnEqual
+ //
+ this.btnEqual.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.btnEqual.Location = new System.Drawing.Point(294, 428);
+ this.btnEqual.Name = "btnEqual";
+ this.btnEqual.Size = new System.Drawing.Size(88, 64);
+ this.btnEqual.TabIndex = 15;
+ this.btnEqual.Text = "=";
+ this.btnEqual.UseVisualStyleBackColor = true;
+ this.btnEqual.Click += new System.EventHandler(this.btnEqual_Click);
+ //
+ // btnDot
+ //
+ this.btnDot.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.btnDot.Location = new System.Drawing.Point(200, 428);
+ this.btnDot.Name = "btnDot";
+ this.btnDot.Size = new System.Drawing.Size(88, 64);
+ this.btnDot.TabIndex = 14;
+ this.btnDot.Text = ".";
+ this.btnDot.UseVisualStyleBackColor = true;
+ this.btnDot.Click += new System.EventHandler(this.btnDot_Click);
+ //
+ // btn0
+ //
+ this.btn0.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.btn0.Location = new System.Drawing.Point(106, 428);
+ this.btn0.Name = "btn0";
+ this.btn0.Size = new System.Drawing.Size(88, 64);
+ this.btn0.TabIndex = 13;
+ this.btn0.Text = "0";
+ this.btn0.UseVisualStyleBackColor = true;
+ this.btn0.Click += new System.EventHandler(this.btn0_Click);
+ //
+ // btnSign
+ //
+ this.btnSign.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.btnSign.Location = new System.Drawing.Point(12, 428);
+ this.btnSign.Name = "btnSign";
+ this.btnSign.Size = new System.Drawing.Size(88, 64);
+ this.btnSign.TabIndex = 12;
+ this.btnSign.Text = "±";
+ this.btnSign.UseVisualStyleBackColor = true;
+ //
+ // btnDivide
+ //
+ this.btnDivide.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.btnDivide.Location = new System.Drawing.Point(294, 148);
+ this.btnDivide.Name = "btnDivide";
+ this.btnDivide.Size = new System.Drawing.Size(88, 64);
+ this.btnDivide.TabIndex = 16;
+ this.btnDivide.Text = "÷";
+ this.btnDivide.UseVisualStyleBackColor = true;
+ this.btnDivide.Click += new System.EventHandler(this.btnDivide_Click);
+ //
+ // btnPercent
+ //
+ this.btnPercent.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.btnPercent.Location = new System.Drawing.Point(200, 148);
+ this.btnPercent.Name = "btnPercent";
+ this.btnPercent.Size = new System.Drawing.Size(88, 64);
+ this.btnPercent.TabIndex = 17;
+ this.btnPercent.Text = "%";
+ this.btnPercent.UseVisualStyleBackColor = true;
+ this.btnPercent.Click += new System.EventHandler(this.btnPercent_Click);
+ //
+ // btnClear
+ //
+ this.btnClear.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.btnClear.Location = new System.Drawing.Point(12, 148);
+ this.btnClear.Name = "btnClear";
+ this.btnClear.Size = new System.Drawing.Size(88, 64);
+ this.btnClear.TabIndex = 18;
+ this.btnClear.Text = "C";
+ this.btnClear.UseVisualStyleBackColor = true;
+ this.btnClear.Click += new System.EventHandler(this.btnClear_Click);
+ //
+ // btnBack
+ //
+ this.btnBack.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.btnBack.Location = new System.Drawing.Point(106, 148);
+ this.btnBack.Name = "btnBack";
+ this.btnBack.Size = new System.Drawing.Size(88, 64);
+ this.btnBack.TabIndex = 19;
+ this.btnBack.Text = "<";
+ this.btnBack.UseVisualStyleBackColor = true;
+ this.btnBack.Click += new System.EventHandler(this.btnBack_Click);
+ //
+ // lblDisplay
+ //
+ this.lblDisplay.AutoSize = true;
+ this.lblDisplay.BackColor = System.Drawing.SystemColors.ControlLightLight;
+ this.lblDisplay.Font = new System.Drawing.Font("Microsoft Sans Serif", 48F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.lblDisplay.Location = new System.Drawing.Point(12, 63);
+ this.lblDisplay.MinimumSize = new System.Drawing.Size(370, 0);
+ this.lblDisplay.Name = "lblDisplay";
+ this.lblDisplay.Size = new System.Drawing.Size(370, 73);
+ this.lblDisplay.TabIndex = 20;
+ this.lblDisplay.Text = "0";
+ this.lblDisplay.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+ this.lblDisplay.Click += new System.EventHandler(this.lblDisplay_Click);
+ //
+ // Form1
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(394, 508);
+ this.Controls.Add(this.lblDisplay);
+ this.Controls.Add(this.btnBack);
+ this.Controls.Add(this.btnClear);
+ this.Controls.Add(this.btnPercent);
+ this.Controls.Add(this.btnDivide);
+ this.Controls.Add(this.btnEqual);
+ this.Controls.Add(this.btnDot);
+ this.Controls.Add(this.btn0);
+ this.Controls.Add(this.btnSign);
+ this.Controls.Add(this.btnPlus);
+ this.Controls.Add(this.btn3);
+ this.Controls.Add(this.btn2);
+ this.Controls.Add(this.btn1);
+ this.Controls.Add(this.btnMinus);
+ this.Controls.Add(this.btn6);
+ this.Controls.Add(this.btn5);
+ this.Controls.Add(this.btn4);
+ this.Controls.Add(this.btnMultiply);
+ this.Controls.Add(this.btn9);
+ this.Controls.Add(this.btn8);
+ this.Controls.Add(this.btn7);
+ this.Name = "Form1";
+ this.Text = "Form1";
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Button btn7;
+ private System.Windows.Forms.Button btn8;
+ private System.Windows.Forms.Button btn9;
+ private System.Windows.Forms.Button btnMultiply;
+ private System.Windows.Forms.Button btnMinus;
+ private System.Windows.Forms.Button btn6;
+ private System.Windows.Forms.Button btn5;
+ private System.Windows.Forms.Button btn4;
+ private System.Windows.Forms.Button btnPlus;
+ private System.Windows.Forms.Button btn3;
+ private System.Windows.Forms.Button btn2;
+ private System.Windows.Forms.Button btn1;
+ private System.Windows.Forms.Button btnEqual;
+ private System.Windows.Forms.Button btnDot;
+ private System.Windows.Forms.Button btn0;
+ private System.Windows.Forms.Button btnSign;
+ private System.Windows.Forms.Button btnDivide;
+ private System.Windows.Forms.Button btnPercent;
+ private System.Windows.Forms.Button btnClear;
+ private System.Windows.Forms.Button btnBack;
+ private System.Windows.Forms.Label lblDisplay;
+ }
+}
+
diff --git a/CPE200Lab1/CPE200Lab1/work1.cs b/CPE200Lab1/CPE200Lab1/work1.cs
new file mode 100644
index 00000000..63ff96af
--- /dev/null
+++ b/CPE200Lab1/CPE200Lab1/work1.cs
@@ -0,0 +1,256 @@
+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 CPE200Lab1
+{
+ public partial class Form1 : Form
+ {
+ private double p;
+ private double sum;
+ private double i;
+ private double h=0;
+
+
+
+ public Form1()
+ {
+ InitializeComponent();
+ }
+
+
+ private void btnClear_Click(object sender, EventArgs e)
+ {
+
+ h = 0;
+ lblDisplay.Text = "0";
+ }
+
+ private void btn1_Click(object sender, EventArgs e)
+ {
+
+ if (lblDisplay.Text == "0")
+ {
+ lblDisplay.Text = "";
+ }
+ lblDisplay.Text = lblDisplay.Text + "1";
+
+ }
+
+ private void lblDisplay_Click(object sender, EventArgs e)
+ {
+
+ }
+
+ private void btn2_Click(object sender, EventArgs e)
+ {
+
+ if (lblDisplay.Text == "0")
+ {
+ lblDisplay.Text = "";
+ }
+ lblDisplay.Text = lblDisplay.Text + "2";
+ }
+
+ private void btn3_Click(object sender, EventArgs e)
+ {
+
+ if (lblDisplay.Text == "0")
+ {
+ lblDisplay.Text = "";
+ }
+ lblDisplay.Text = lblDisplay.Text + "3";
+ }
+
+ private void btn4_Click(object sender, EventArgs e)
+ {
+
+ if (lblDisplay.Text == "0")
+ {
+ lblDisplay.Text = "";
+ }
+ lblDisplay.Text = lblDisplay.Text + "4";
+ }
+
+ private void btn5_Click(object sender, EventArgs e)
+ {
+
+ if (lblDisplay.Text == "0")
+ {
+ lblDisplay.Text = "";
+ }
+ lblDisplay.Text = lblDisplay.Text + "5";
+ }
+
+ private void btn6_Click(object sender, EventArgs e)
+ {
+
+ if (lblDisplay.Text == "0")
+ {
+ lblDisplay.Text = "";
+ }
+ lblDisplay.Text = lblDisplay.Text + "6";
+ }
+
+ private void btn7_Click(object sender, EventArgs e)
+ {
+
+ if (lblDisplay.Text == "0")
+ {
+ lblDisplay.Text = "";
+ }
+ lblDisplay.Text = lblDisplay.Text + "7";
+ }
+
+ private void btn8_Click(object sender, EventArgs e)
+ {
+
+ if (lblDisplay.Text == "0")
+ {
+ lblDisplay.Text = "";
+ }
+ lblDisplay.Text = lblDisplay.Text + "8";
+ }
+
+ private void btn9_Click(object sender, EventArgs e)
+ {
+
+ if (lblDisplay.Text == "0")
+ {
+ lblDisplay.Text = "";
+ }
+ lblDisplay.Text = lblDisplay.Text + "9";
+ }
+
+ private void btn0_Click(object sender, EventArgs e)
+ {
+ lblDisplay.Text = lblDisplay.Text + "0";
+ }
+
+ private void btnPlus_Click(object sender, EventArgs e)
+ {
+
+ sum = Double.Parse(lblDisplay.Text);
+ lblDisplay.Text = "0";
+ i = 1;
+ h = 0;
+
+
+
+ }
+
+ private void btnMinus_Click(object sender, EventArgs e)
+ {
+ sum = Double.Parse(lblDisplay.Text);
+ lblDisplay.Text = "0";
+ i = 2;
+ h = 0;
+
+ }
+
+ private void btnMultiply_Click(object sender, EventArgs e)
+ {
+ sum = Double.Parse(lblDisplay.Text);
+ lblDisplay.Text = "0";
+ i = 3;
+ h = 0;
+ }
+
+ private void btnDivide_Click(object sender, EventArgs e)
+ {
+
+ sum = Double.Parse(lblDisplay.Text);
+ lblDisplay.Text = "0";
+ i = 4;
+ h = 0;
+
+ }
+
+ private void btnDot_Click(object sender, EventArgs e)
+ {
+ if(h==0)
+ {
+ lblDisplay.Text = lblDisplay.Text + ".";
+ h = 1;
+ }
+
+
+
+ }
+
+
+
+
+ private void btnEqual_Click(object sender, EventArgs e)
+ {
+ p = Double.Parse(lblDisplay.Text);
+ if (i == 1)
+ {
+ sum = sum + p;
+
+
+ }
+ if (i == 2)
+ {
+ sum = sum - p;
+ }
+ if (i == 3)
+ {
+ sum = sum * p;
+
+ }
+ if (i == 4)
+ {
+ sum = sum / p;
+ }
+
+
+ lblDisplay.Text = sum.ToString();
+
+
+
+
+ }
+ private double m;
+ private void btnPercent_Click(object sender, EventArgs e)
+ {
+ m = Double.Parse(lblDisplay.Text);
+ if(sum == 0)
+ {
+ m = m / 100;
+ }
+ else
+ {
+ m = (m / 100) * sum;
+
+ }
+ if (m % 1 == 0)
+ {
+ h = 0;
+
+ }
+ else h = 1;
+
+ lblDisplay.Text = m.ToString();
+ }
+
+ private void btnBack_Click(object sender, EventArgs e)
+ {
+ int x = lblDisplay.Text.Length;
+ if(lblDisplay.Text == "")
+ {
+ lblDisplay.Text = "";
+ }
+ else
+ {
+ lblDisplay.Text = lblDisplay.Text.Remove(x - 1);
+ }
+ }
+ }
+}
diff --git a/CPE200Lab1/CPE200Lab1/work1.resx b/CPE200Lab1/CPE200Lab1/work1.resx
new file mode 100644
index 00000000..29dcb1b3
--- /dev/null
+++ b/CPE200Lab1/CPE200Lab1/work1.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file