WELCOME TO MY WORLD

Hi THERE

I'M INDRAJIT. B.Tech [ CSE ] + MBA [ IT-HR ]. WORKING AS SAP BO-BI WITH S4 HANA SENOR CONSULTANT.

Subscribe to this blog!

Receive the latest posts by email. Just enter your email below if you want to subscribe!

My Other Works
Loading...

[ CALCULATOR ]

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace CALCULATOR
{
    public partial class Form1 : Form
    {
        float oneno, twono, total = 0.0f,temp;
        int count=0,point=0;
        public Form1()
        {
            InitializeComponent();
        }

        private void C_Click(object sender, EventArgs e)
        {
            disp.Text = "0.";
            point = 0;
        }

        private void BTN1_Click(object sender, EventArgs e)
        {
            if (disp.Text == "0." || disp.Text=="0")
            {
                disp.Clear();
                disp.Text = disp.Text.ToString() + "1";

            }
            else
                disp.Text = disp.Text.ToString() + "1";
        }

        private void BTN2_Click(object sender, EventArgs e)
        {
            if (disp.Text == "0." || disp.Text == "0")
            {
                disp.Clear();
                disp.Text = disp.Text.ToString() + "2";

            }
            else
                disp.Text = disp.Text.ToString() + "2";
        }

        private void BTN3_Click(object sender, EventArgs e)
        {
            if (disp.Text == "0." || disp.Text == "0")
            {
                disp.Clear();
                disp.Text = disp.Text.ToString() + "3";

            }
            else
                disp.Text = disp.Text.ToString() + "3";
        }

        private void BTN4_Click(object sender, EventArgs e)
        {
            if (disp.Text == "0." || disp.Text == "0")
            {
                disp.Clear();
                disp.Text = disp.Text.ToString() + "4";

            }
            else
                disp.Text = disp.Text.ToString() + "4";
        }

        private void BTN5_Click(object sender, EventArgs e)
        {
            if (disp.Text == "0." || disp.Text == "0")
            {
                disp.Clear();
                disp.Text = disp.Text.ToString() + "5";

            }
            else
                disp.Text = disp.Text.ToString() + "5";
        }

        private void BTN6_Click(object sender, EventArgs e)
        {
            if (disp.Text == "0." || disp.Text == "0")
            {
                disp.Clear();
                disp.Text = disp.Text.ToString() + "6";

            }
            else
                disp.Text = disp.Text.ToString() + "6";
        }

        private void BTN7_Click(object sender, EventArgs e)
        {
            if (disp.Text == "0." || disp.Text == "0")
            {
                disp.Clear();
                disp.Text = disp.Text.ToString() + "7";

            }
            else
                disp.Text = disp.Text.ToString() + "7";
        }

        private void BTN8_Click(object sender, EventArgs e)
        {
            if (disp.Text == "0." || disp.Text == "0" )
            {
                disp.Clear();
                disp.Text = disp.Text.ToString() + "8";

            }
            else
                disp.Text = disp.Text.ToString() + "8";
        }

        private void BTN9_Click(object sender, EventArgs e)
        {
            if (disp.Text == "0." || disp.Text == "0")
            {
                disp.Clear();
                disp.Text = disp.Text.ToString() + "9";

            }
            else
                disp.Text = disp.Text.ToString() + "9";
        }

        private void BTN0_Click(object sender, EventArgs e)
        {
            if (disp.Text == "0." || disp.Text == "0")
            {
                disp.Clear();
                disp.Text = disp.Text.ToString() + "0";

            }
            else
                disp.Text = disp.Text.ToString() + "0";
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            oneno = float.Parse(disp.Text);
            count = 1;
            disp.Clear();
            point = 0;
        }

        private void button8_Click(object sender, EventArgs e)
        {
            switch (count)
            {
                case 1:
                    {
                        twono = float.Parse(disp.Text);
                        total = oneno / twono;
                        disp.Text = total.ToString();
                        break;
                    }
                case 2:
                    {
                        twono = float.Parse(disp.Text);
                        total = oneno * twono;
                        disp.Text = total.ToString();
                        break;
                    }
                case 3:
                    {
                        twono = float.Parse(disp.Text);
                        total = oneno - twono;
                        disp.Text = total.ToString();
                        break;
                    }
                case 4:
                    {
                        twono = float.Parse(disp.Text);
                        total = oneno + twono;
                        disp.Text = total.ToString();
                        break;
                    }
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            oneno = float.Parse(disp.Text);
            count = 2;
            disp.Clear();
            point = 0;
        }

        private void button3_Click(object sender, EventArgs e)
        {
            oneno = float.Parse(disp.Text);
            count = 3;
            disp.Clear();
            point = 0;
        }

        private void button4_Click(object sender, EventArgs e)
        {
            oneno = float.Parse(disp.Text);
            count = 4;
            disp.Clear();
            point = 0;
        }

        private void button5_Click(object sender, EventArgs e)
        {
          
        }

        private void button7_Click(object sender, EventArgs e)
        {
            oneno = float.Parse(disp.Text);
            total = 1 / oneno;
            disp.Clear();
            disp.Text = total.ToString();
            point = 0;
        }

        private void button11_Click(object sender, EventArgs e)
        {
            memory.Text = "M";
            temp = float.Parse(disp.Text);
        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {

        }

        private void button9_Click(object sender, EventArgs e)
        {
            temp = 0;
            memory.Clear();
            point = 0;
        }

        private void button10_Click(object sender, EventArgs e)
        {
            disp.Text = temp.ToString();
        }

        private void memory_TextChanged(object sender, EventArgs e)
        {

        }

        private void BTNDOT_Click(object sender, EventArgs e)
        {
          
            if (point == 0)
            {
                disp.Text = disp.Text.ToString() + ".";
                point = 1;
            }
        }

        private void button13_Click(object sender, EventArgs e)
        {

        }

        private void BACK_Click(object sender, EventArgs e)
        {
            String str = disp.Text;
            int len;
            len = str.Length;
            disp.Text = "";
            for (int i = 0; i < len - 1; i++)
            {
                disp.Text = disp.Text + Convert.ToString(str[i]);
            }
        }

      
    }
}
Share on Google Plus

About AXEL BLAZE [ FATAL ERROR ]

0 comments:

Post a Comment