WELCOME TO MY BLOG :)
1. Buka sharp develop :
2. Pilih new solution :
3. Pilih windows form application dan beri nama file :
4. Klik design dan buat design aplikasi kalkulator :
5. Buat design sesuai selera anda atau seperti ini :
6. Buat source code nya lalu running kan program ini :
/*
* Created by SharpDevelop.
* User: mhs
* Date: 3/11/2015
* Time: 8:55 AM
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
namespace Calculator_Iwan
{
/// <summary>
/// Description of MainForm.
/// </summary>
public partial class MainForm : Form
{
double a,b,c,d,f,g; // deklarasi untuk awal program
public MainForm()
{
//
// The InitializeComponent() call is required for Windows Forms designer support.
//
InitializeComponent();
//
// TODO: Add constructor code after the InitializeComponent() call.
//
}
void Button3Click(object sender, EventArgs e)
{
Close (); // unutl mengakhiri program
}
void Button1Click(object sender, EventArgs e) // untuk mereset program yang sudah di runningkan
{
textBox1.Text = "";
textBox2.Text = "";
textBox3.Text = "";
textBox4.Text = "";
textBox5.Text = "";
textBox6.Text = "";
}
void Button2Click(object sender, EventArgs e)
{
a = Convert.ToDouble(textBox1.Text);
b = Convert.ToDouble(textBox3.Text);
c = Convert.ToDouble(textBox2.Text);
d = Convert.ToDouble(textBox4.Text);
if (penjumlahan.Checked == true)
{
f = a + b;
g = c + d;
textBox5.Text = f.ToString();
textBox6.Text = g.ToString();
}
else if (pengurangan.Checked == true)
{
f = a - b;
g = c - d;
textBox5.Text = f.ToString();
textBox6.Text = g.ToString();
}
else if (perkalian.Checked == true)
{
f = a * c - b * d;
g = a * d + c * b*-1;
textBox5.Text = f.ToString();
textBox6.Text = g.ToString();
}
else if (pembagian.Checked == true)
{
f = (a * b + c * d) / (b * b + d * d);
g = (b * c - a * d*-1) / (b * b + d * d);
textBox5.Text = f.ToString();
textBox6.Text = g.ToString();
}
}
void Label4Click(object sender, EventArgs e)
{
}
}
}
7. Isi inputan nya sesuai yang diinginkan :
8. Jika ingin reset dapat tekan tombol nya :
9. Jika ingin exit dapat tekan tombol nya :
Selesai .....
atau kunjungi link youtube saya:
https://www.youtube.com/watch?v=ckjq37vUwaA&feature=youtu.be
No comments:
Post a Comment