Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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 WindowsFormsApplication1
- {
- public partial class Form1 : Form
- {
- enum oper
- {
- plus,
- minus,
- mnozenie,
- dziel
- }
- public Form1()
- {
- InitializeComponent();
- }
- float pamiec;
- oper operacja;
- private void _1_Click(object sender, EventArgs e)
- {
- textBox1.Text += "1";
- //float.Parse("67");
- }
- private void _2_Click(object sender, EventArgs e)
- {
- textBox1.Text += "2";
- }
- private void _3_Click(object sender, EventArgs e)
- {
- textBox1.Text += "3";
- }
- private void _4_Click(object sender, EventArgs e)
- {
- textBox1.Text += "4";
- }
- private void _5_Click(object sender, EventArgs e)
- {
- textBox1.Text += "5";
- }
- private void _6_Click(object sender, EventArgs e)
- {
- textBox1.Text += "6";
- }
- private void _7_Click(object sender, EventArgs e)
- {
- textBox1.Text += "7";
- }
- private void _8_Click(object sender, EventArgs e)
- {
- textBox1.Text += "8";
- }
- private void _9_Click(object sender, EventArgs e)
- {
- textBox1.Text += "9";
- }
- private void _0_Click(object sender, EventArgs e)
- {
- textBox1.Text += "0";
- }
- private void _plus_Click(object sender, EventArgs e)
- {
- pamiec = float.Parse(textBox1.Text);
- operacja = oper.plus;
- textBox1.Text="";
- }
- private void _suma_Click(object sender, EventArgs e)
- {
- float wynik = 0;
- float arg2=float.Parse(textBox1.Text);
- switch(operacja){
- case oper.plus:
- wynik= pamiec + arg2;
- break;
- case oper.minus:
- wynik = pamiec - arg2;
- break;
- case oper.dziel:
- wynik = pamiec / arg2;
- break;
- case oper.mnozenie:
- wynik = pamiec * arg2;
- break;
- }
- textBox1.Text=wynik.ToString();
- }
- private void _minus_Click(object sender, EventArgs e)
- {
- pamiec = float.Parse(textBox1.Text);
- operacja = oper.minus;
- textBox1.Text = "";
- }
- private void _mnozenie_Click(object sender, EventArgs e)
- {
- pamiec = float.Parse(textBox1.Text);
- operacja = oper.mnozenie;
- textBox1.Text = "";
- }
- private void _dziel_Click(object sender, EventArgs e)
- {
- pamiec = float.Parse(textBox1.Text);
- operacja = oper.dziel;
- textBox1.Text = "";
- }
- private void przecinek_Click(object sender, EventArgs e)
- {
- textBox1.Text += ",";
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement