Pages

Showing posts with label oop. Show all posts
Showing posts with label oop. Show all posts

Wednesday, November 4, 2015

How to Create a Memory Matching Game in C#

This is the code but you have to create new project and redesign the game.The link of the complete game is given you can download the project .

link of the project : https://www.dropbox.com/s/wsnovk1rugn93ld/C%23.rar?dl=0

























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 MatchingGame
{
    public partial class Form1 : Form
    {
        // firstClicked points to the first Label control 
        // that the player clicks, but it will be null 
        // if the player hasn't clicked a label yet.
        Label firstClicked = null;

        // secondClicked points to the second Label control 
        // that the player clicks.
        Label secondClicked = null;
       
        // Use this Random object to choose random icons for the squares.
        Random random = new Random();

        // Each of these letters is an interesting icon
        // in the Webdings font,
        // and each icon appears twice in this list.
        List<string> icons = new List<string>()
        {
            "!", "!", "N", "N", ",", ",", "k", "k",
            "b", "b", "v", "v", "w", "w", "z", "z"
        };

        /// <summary>
        /// Assign each icon from the list of icons to a random square
        /// </summary>
        private void AssignIconsToSquares()
        {
            // The TableLayoutPanel has 16 labels,
            // and the icon list has 16 icons,
            // so an icon is pulled at random from the list
            // and added to each label.
            foreach (Control control in tableLayoutPanel1.Controls)
            {
                Label iconLabel = control as Label;
                if (iconLabel != null)
                {
                    int randomNumber = random.Next(icons.Count);
                    iconLabel.Text = icons[randomNumber];
                    iconLabel.ForeColor = iconLabel.BackColor;
                    icons.RemoveAt(randomNumber);
                }
            }
        }


        public Form1()
        {
            InitializeComponent();
            AssignIconsToSquares();
        }

        /// <summary>
        /// Every label's Click event is handled by this event handler.
        /// </summary>
        /// <param name="sender">The label that was clicked.</param>
        /// <param name="e"></param>
        private void label_Click(object sender, EventArgs e)
        {
            // The timer is only on after two non-matching 
            // icons have been shown to the player, 
            // so ignore any clicks if the timer is running
            if (timer1.Enabled == true)
                return;
           
            Label clickedLabel = sender as Label;

            if (clickedLabel != null)
            {
                // If the clicked label is black, the player clicked
                // an icon that's already been revealed --
                // ignore the click.
                if (clickedLabel.ForeColor == Color.Black)
                    // All done - leave the if statements.
                    return;

                // If firstClicked is null, this is the first icon 
                // in the pair that the player clicked,
                // so set firstClicked to the label that the player 
                // clicked, change its color to black, and return.
                if (firstClicked == null)
                {
                    firstClicked = clickedLabel;
                    firstClicked.ForeColor = Color.Black;

                    // All done - leave the if statements.
                    return;
                }

                // If the player gets this far, the timer isn't
                // running and firstClicked isn't null,
                // so this must be the second icon the player clicked
                // Set its color to black.
                secondClicked = clickedLabel;
                secondClicked.ForeColor = Color.Black;

                // Check to see if the player won.
                CheckForWinner();
               
                // If the player clicked two matching icons, keep them 
                // black and reset firstClicked and secondClicked 
                // so the player can click another icon.
                if (firstClicked.Text == secondClicked.Text)
                {
                    firstClicked = null;
                    secondClicked = null;
                    return;
                }
               
                // If the player gets this far, the player 
                // clicked two different icons, so start the 
                // timer (which will wait three quarters of 
                // a second, and then hide the icons).
                timer1.Start();
            }
        }

        /// <summary>
        /// This timer is started when the player clicks 
        /// two icons that don't match,
        /// so it counts three quarters of a second 
        /// and then turns itself off and hides both icons.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void timer1_Tick(object sender, EventArgs e)
        {
            // Stop the timer.
            timer1.Stop();

            // Hide both icons.
            firstClicked.ForeColor = firstClicked.BackColor;
            secondClicked.ForeColor = secondClicked.BackColor;

            // Reset firstClicked and secondClicked 
            // so the next time a label is
            // clicked, the program knows it's the first click.
            firstClicked = null;
            secondClicked = null;
        }

        /// <summary>
        /// Check every icon to see if it is matched, by 
        /// comparing its foreground color to its background color. 
        /// If all of the icons are matched, the player wins.
        /// </summary>
        private void CheckForWinner()
        {
            // Go through all of the labels in the TableLayoutPanel, 
            // checking each one to see if its icon is matched.
            foreach (Control control in tableLayoutPanel1.Controls)
            {
                Label iconLabel = control as Label;

                if (iconLabel != null)
                {
                    if (iconLabel.ForeColor == iconLabel.BackColor)
                        return;
                }
            }

            // If the loop didn’t return, it didn't find
            // any unmatched icons.
            // That means the user won. Show a message and close the form.
            MessageBox.Show("You matched all the icons!", "Congratulations!");
            Close();
        }

    }
}


Friday, August 7, 2015

Code for Program that performs selection search in C++ Programming

#include <iostream.h>
#include <conio.h>

class sel_search
{
int d[50],s,search_val;
public:
void getdata(void);
int search(void);
void display(void);
};

void sel_search :: getdata(void)
{
cout<<endl<<endl;
cout<<"How many size of array you want to create:-";
cin>>s;
cout<<"Enter "<<s<<" Integers\n";
for(int i=0;i<s;i++)
    cin>>d[i];
cout<<"\n\nEnter your search:-";
cin>>search_val;
}

int  sel_search :: search(void)
{
for(int i=0;i<s;i++)
{
    if(d[i]==search_val)
           return(i+1);
}
return(-1);
}

void sel_search :: display(void)
{
int result;
cout<<"\n\n\n";
result=search();
if(result==-1)
    cout<<"\nEntered Search is Illegal\n";
else
    cout<<"\nSearch is Located at "<<result<<" Position";
}

void main()
{
clrscr();
sel_search o1;
o1.getdata();
o1.display();
getch();
}


Saturday, June 20, 2015

C# Program to Implement Binary Search Tree using Linked List

using System;
using System.Collections.Generic;
using System.Text;
namespace TreeSort
{
    class Node
    {
        public int item;
        public Node leftc;
        public Node rightc;
        public void display()
        {
            Console.Write("[");
            Console.Write(item);
            Console.Write("]");
        }
    }
    class Tree
    {
        public Node root;
        public Tree()
        {
            root = null;
        }
        public Node ReturnRoot()
        {
            return root;
        }
        public void Insert(int id)
        {
            Node newNode = new Node();
            newNode.item = id;
            if (root == null)
                root = newNode;
            else
            {
                Node current = root;
                Node parent;
                while (true)
                {
                    parent = current;
                    if (id < current.item)
                    {
                        current = current.leftc;
                        if (current == null)
                        {
                            parent.leftc = newNode;
                            return;
                        }
                    }
                    else
                    {
                        current = current.rightc;
                        if (current == null)
                        {
                            parent.rightc = newNode;
                            return;
                        } } } }
        }
        public void Preorder(Node Root)
        {
            if (Root != null)
            {
                Console.Write(Root.item + " ");
                Preorder(Root.leftc);
                Preorder(Root.rightc);
            }
        }
        public void Inorder(Node Root)
        {
            if (Root != null)
            {
                Inorder(Root.leftc);
                Console.Write(Root.item + " ");
                Inorder(Root.rightc);
            }
        }
        public void Postorder(Node Root)
        {
            if (Root != null)
            {
                Postorder(Root.leftc);
                Postorder(Root.rightc);
                Console.Write(Root.item + " ");
            }
        }
    }
    class Program
    {
        static void Main(string[] args)
        {
            Tree theTree = new Tree();
            theTree.Insert(20);
            theTree.Insert(25);
            theTree.Insert(45);
            theTree.Insert(15);
            theTree.Insert(67);
            theTree.Insert(43);
            theTree.Insert(80);
            theTree.Insert(33);
            theTree.Insert(67);
            theTree.Insert(99);
            theTree.Insert(91);           
            Console.WriteLine("Inorder Traversal : ");
            theTree.Inorder(theTree.ReturnRoot());
            Console.WriteLine(" ");
            Console.WriteLine();
            Console.WriteLine("Preorder Traversal : ");
            theTree.Preorder(theTree.ReturnRoot());
            Console.WriteLine(" ");
            Console.WriteLine();
            Console.WriteLine("Postorder Traversal : ");
            theTree.Postorder(theTree.ReturnRoot());
            Console.WriteLine(" ");
            Console.ReadLine();
        }
    }

}

Wednesday, June 17, 2015

Statistical Analysis and Histogram


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Statistiacal_Analysis
{
    class data
    {
        //Function  for Mean-----------------------------------------------------------------------------------------
        public int mean(int[] arr, int num)
        {
            int me = 0;
            for (int i = 0; i < num; i++)
            {
                me = me + arr[i];
            }
            me = me / num;
            return me;
        }

        //------------------------------------------------------------------------------------------------------------------
        //Function for Median----------------------------------------------------------------------------------------
        public void median(int[] arr, int num)
        {
            int me = 0;
            // For Even Size Of The Array----------------------------------------------------------------------------
            if (num % 2 == 0)
            {
                me = ((arr[(num / 2) - 1]) + (arr[num / 2])) / 2;

                Console.WriteLine("The Median Is : " + me);
                Console.WriteLine("=======================================================");
            }
            // For Odd  Size Of The Array---------------------------------------------------------------------------
            else
            {
                me = arr[((num + 1) / 2) - 1];

                Console.WriteLine("The Median is : " + me);
                Console.WriteLine("=======================================================");
            }

        }

        //-----------------------------------------------------------------------------------------------------------------
        //Function  for Mode-------------------------------------------------------------------------------------
        public void mode(int[] array, int size)
        {

            int counter = 1;
            int max = 0;
            int Mode = array[0];
            for (int pass = 0; pass < size - 1; pass++)
            {
                if (array[pass] == array[pass + 1])
                {
                    counter++;
                    if (counter > max)
                    {
                        max = counter;
                        Mode = array[pass];
                    }
                }
                else
                    counter = 1; // reset counter.
            }
            Console.WriteLine("The mode is: " + Mode);
            Console.WriteLine("========================================================");
        }

        //------------------------------------------------------------------------------------------------------------------
        //Function for Standerd Deviation--------------------------------------------------------------------------
        public void stanDev(int[] arr, int num)
        {

            double sd = 0.0;
            double power = 2.0;
            double val = 0.0;
            int Mean = mean(arr, num);
            for (int i = 0; i < num; i++)
            {
                val = (arr[i] - Mean);
                sd = sd + (Math.Pow(val, power)) / (num - 1);
            }

            Console.WriteLine("The Standerd Deviation Is : " + (Math.Sqrt(sd)));
            Console.WriteLine("=======================================================");
        }
        //-----------------------------------------------------------------------------------------------------------------
        //Function For Printing Histogram---------------------------------------------------------------------------
        public void histogram(int[] arr, int num)
        {
            string[][] a = new string[num][];
            for (int i = 0; i < num; i++)
            {
                a[i] = new string[arr[i]];
            }
            Console.Write("Element\t\tValue\t\tHistogram\n");
            Console.WriteLine();
            for (int i = 0; i < num; i++)
            {
                Console.Write(i + "\t\t" + arr[i] + "\t\t");
                for (int j = 0; j < arr[i]; j++)
                {
                    if (j % 4 == 0 && j != 0)
                    {
                        a[i][j] += "|";
                    }
                    else
                    {
                        a[i][j] += "*";
                    }
                   
                    Console.Write(a[i][j]);
                }
                Console.WriteLine();
            }
        }
        //-----------------------------------------------------------------------------------------------------------------
    }
}
//------------------------------------------------- Class data ends here---------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Statistiacal_Analysis
    class Program
    {
        //DRIVER METHOD--------------------------------------------------------------------------------------
        static void Main(string[] args)
        {
            data z = new data();
            string s="";
            // Declarations Of  Variables -----------------------------------------------------------------------
            Random r = new Random();
            int a=0;
            // Dynamically Generated Size In  Array-------------------------------------------------------------
            Console.WriteLine("=======================================================");
            Console.WriteLine("\t\t\t      STAISTICAL DATA ANALYSIS");
            Console.WriteLine("=======================================================");
            Console.Write("Enter The Size OF The Array : ");
            a = int.Parse(Console.ReadLine());
            Console.WriteLine("-------------------------------------------------------------------------------");
            int []N=new int[a];

            // Random Numbers Assigned To The Array-----------------------------------------------------------
            for (int i = 0; i < a; i++)
            {
                N[i] = r.Next(0, 9);
                
                Console.WriteLine("The Collected Sample # "+ i +" Is : " + N[i]);                
            }
            Console.WriteLine("=======================================================");
            for (int i = 0; i < a; i++)
            {
                //Sorting The Array In Order To Calculate Mode---------------------------------------------------
                Array.Sort(N);

                //Printing The Sorted Array----------------------------------------------------------------------------
                Console.WriteLine("The Sorted Data Is : " + N[i]);               
            }
          
            //---------------------------------------------------------------------------------------------------------------

            //function call for Mean------------------------------------------------------------------------------------
            Console.WriteLine("=======================================================");
            Console.WriteLine("The Mean Is : "+z.mean(N,a));
            Console.WriteLine("=====================================================");
            //---------------------------------------------------------------------------------------------------------------

            //function call for Median----------------------------------------------------------------------------------
            z.median(N,a);            
            //--------------------------------------------------------------------------------------------------------------
            //function call for Mode------------------------------------------------------------------------------------
            z.mode(N, a);
            //--------------------------------------------------------------------------------------------------------------
            //function call for Standerd Deviation-------------------------------------------------------------------           
            z. stanDev(N, a);            
            //---------------------------------------------------------------------------------------------------------------

            //function call for Histogram-------------------------------------------------------------------------------
            Console.Write("FOR HISTOGRAM PRESS H OR TO CLOSE PRESS ENTER :  ");
            s=Console.ReadLine();
            if (s == "h")
            {
                z.histogram(N, a);
            }
            else
            {
                Environment.Exit(0);
            }

            Console.ReadLine();
            
        }
    }
}

Tuesday, June 9, 2015

Visual Calculator in C# Using Classes




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 visual_calculator
{
    class Methods
    {
        public  int Factorial(int input)
        {
            int answer = 0;
            int count = 0;
            if (input > 0)
            {
                count = 1;
                while (count <= input)
                {
                    if (count == 1)
                    {
                        answer = 1;
                        count++;
                    }
                    else
                    {
                        answer = count * answer;
                        count++;
                    }
                }
            }
            else
            {
                MessageBox.Show("Please enter only a positive integer.");
            }

            return answer;
        }
        public  void toBin(int dec)
        {
            int count = 0;
            int[] bin = new int[100];

            while (dec > 0)
            {
                bin[count] = dec % 2;    //store Binary value in array bin
                count++;
                dec = dec / 2;  //for moving from unit to ten's or next
            }
            for (int j = count - 1; j >= 0; j--)//for loop for printing the array elements in reverse

                Console.Write(bin[j]);
        }
        //--------------------------------------------------------------------------------------------------------
        public  void toOct(int dec)
        {
            int count = 0;
            int[] oct = new int[100];

            while (dec > 0)
            {
                oct[count] = dec % 8;    //store octal in oct array
                count++;
                dec = dec / 8;           //for moving from unit to ten's or next
            }
            for (int j = count - 1; j >= 0; j--)//for loop for printing the array elements in reverse
            {
                Console.Write(oct[j]);
            }
        }

        //--------------------------------------------------------------------------------------------------------
        public  int toHex(int dec)
        {
            int count = 0;
            int[] hex = new int[100];
            while (dec > 0)
            {
                hex[count] = dec % 16; //store stuff in array hex
                count++;
                dec = dec / 16;
            }
            for (int j = count - 1; j >= 0; j--)    //for loop for printing the array elements in reverse
                if (hex[j] < 10)                //if array element is less than 10 then printing the array element
                {
                    Console.Write(hex[j]);
                }
                else
                    switch (hex[j])   //if array element is greater than 10 then replace 10 with A uptill 15 which is F
                    {
                        case 10:
                            Console.Write('A');
                            break;
                        case 11:
                            Console.Write('B');
                            break;
                        case 12:
                            Console.Write('C');
                            break;
                        case 13:
                            Console.Write('D');
                            break;
                        case 14:
                            Console.Write('E');
                            break;
                        case 15:
                            Console.Write('F');
                            break;
                    }
            return hex[count];
        }
        //------------------------------------------------------------------------------
        public  int BintoDecimal(int des)
        {

            int d;
            double num = 0;
            for (int i = 0; des != 0; i++)
            {
                d = des % 10;
                num += (d) * (Math.Pow(2, i));  //Multiplying number with power of 2 increasing from left to right
                des = des / 10;
            }
            return Convert.ToInt32(num);
        }

        public  void BintoOct(int oct)
        {
            toOct(oct);
        }
        public  void BintoHexa(int oct)
        {
            toHex(oct);
        }
        //-------------------------------------------------------------------------------
        public  int OcttoDes(int des)
        {
            int d;
            double num = 0;
            for (int i = 0; des != 0; i++)
            {
                d = des % 10;
                num += d * (Math.Pow(8, i)); //Multiplying number with power of 8 increasing from left to right
                des = des / 10;
            }
            return Convert.ToInt32(num);
        }
       
        //-------------------------------------------------------------------------------
    }
}

Source code:form1.cs
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 visual_calculator
{
    public partial class CalculateForm : Form
    {
        int input1,sum=0,sub=0,pro=0,div=0,fact=0,sin=0,cos=0,tan=0,cosec=0,sec=0,cot=0,des,log,oct,pow,tenpow,bin,squ,ans;
        int destohex,mod;
        string hexValue;
        double answer,trig = 0;
        Methods m = new Methods();
        public CalculateForm()
        {
            InitializeComponent();
        }      
      
        private void SqrtButton_Click(object sender, EventArgs e)
        {
            double a=double.Parse(textBox3.Text);
            textBox3.Text = Math.Sqrt(a).ToString();
        }

        private void ReciprocalButton_Click(object sender, EventArgs e)
        {
            float a = 0;
            a = float.Parse(textBox3.Text);
            a = 1 / a;
            textBox3.Text = a.ToString();
        }

        private void PowerButton_Click(object sender, EventArgs e)
        {
            pow = 1;
            input1 = int.Parse(textBox3.Text);
            textBox3.Text = "";           
        }
           private void TenPowButton_Click(object sender, EventArgs e)
        {
                tenpow = 1;
            input1 = int.Parse(textBox3.Text);
            textBox3.Text = "";              
        } 
        private void DivideButton_Click(object sender, EventArgs e)
        {
            div = 1;
            input1 = Convert.ToInt32(textBox3.Text);
            textBox3.Text = "";
        }

        private void MultiplyButton_Click(object sender, EventArgs e)
        {
            pro = 1;
            input1 = Convert.ToInt32(textBox3.Text);
        }

        private void SubtractButton_Click(object sender, EventArgs e)
        {
            sub = 1;
            input1 = Convert.ToInt32(textBox3.Text);
            textBox3.Text = "";
       
            }

        private void AddButton_Click(object sender, EventArgs e)
        {
           
            sum = 1;
           input1= Convert.ToInt32( textBox3.Text); 
            textBox3.Text="";
        }
        private void FactButton_Click(object sender, EventArgs e)
        {
            fact = 1;
            input1 = Convert.ToInt32(textBox3.Text);
        }
        private void ModButton_Click(object sender, EventArgs e)
        {
            mod = 1;
            input1 = Convert.ToInt32(textBox3.Text);
            textBox3.Text = "";

        }
        private void ClearButton_Click(object sender, EventArgs e)
        {
            textBox3.Text = "";
            textBox3.Clear();
        }

        private void ModulasButton_Click(object sender, EventArgs e)
        {
            double a = 0;
            a = double.Parse(textBox3.Text) % double.Parse(textBox3.Text);
           textBox3.Text= a.ToString();
        }
        private void SinButton_Click(object sender, EventArgs e)
        {
            sin = 1;
            trig = Convert.ToDouble(textBox3.Text);
        }     

       private void OneButton_Click(object sender, EventArgs e)
        {
            textBox3.Text +="1";
        }

        private void TwoButton_Click(object sender, EventArgs e)
        {
            textBox3.Text += "2";
        }

        private void ThreeButton_Click(object sender, EventArgs e)
        {
            textBox3.Text += "3";

        }

        private void button21_Click(object sender, EventArgs e)
        {
            textBox3.Text += "4";

        }

        private void button22_Click(object sender, EventArgs e)
        {
            textBox3.Text += "5";

        }

        private void button23_Click(object sender, EventArgs e)
        {
            textBox3.Text += "6";

        }

        private void button12_Click(object sender, EventArgs e)
        {
            textBox3.Text += "7"; 
        }

        private void button13_Click(object sender, EventArgs e)
        {
            textBox3.Text +="8";
        }

        private void button14_Click(object sender, EventArgs e)
        {
            textBox3.Text += "9";
        }

        private void ZeroButton_Click(object sender, EventArgs e)
        {
            textBox3.Text += "0";
        }

        private void AnsButton_Click(object sender, EventArgs e)
        {
        if (sum==1)
            {
                ans = input1 + Convert.ToInt32(textBox3.Text);
                textBox3.Text = ans.ToString();
               
            }
        else if(sub==1)
        {
             ans = input1 - Convert.ToInt32(textBox3.Text);
             textBox3.Text = ans.ToString();

        }
        else if (div == 1)
        {
            ans = input1 / Convert.ToInt32(textBox3.Text);
            textBox3.Text = ans.ToString();
        }
        else if (pro == 1)
        {
            ans = input1 * Convert.ToInt32(textBox3.Text);
            textBox3.Text = ans.ToString();
        }
        else if(mod==1)
        {
            ans = input1 % Convert.ToInt32(textBox3.Text);
            textBox3.Text = ans.ToString();
        }
        else if (fact == 1)
        {
            ans = m.Factorial(int.Parse(textBox3.Text));
            textBox3.Text = ans.ToString();
        }
        else if (pow == 1)
        {
            double a = Convert.ToDouble(input1);
            double b = Convert.ToDouble(textBox3.Text);
            answer= Math.Pow(a,b);
            textBox3.Text = answer.ToString();
        }
        else if(tenpow==1)
        {
            double a=Math.Pow(10,Convert.ToDouble(input1));
            textBox3.Text=a.ToString();
        }
        else if (sin == 1)
        {
            answer = Math.Sin(trig);
            textBox3.Text = answer.ToString();
        }
        else if (cos == 1)
        {
            answer = Math.Cos(trig);
            textBox3.Text = answer.ToString();
        }
        else if (tan == 1)
        {
            answer = Math.Tan(trig);
            textBox3.Text = answer.ToString();
        }
        else if (sec == 1)
        {
            answer = 1/Math.Cos(trig);
            textBox3.Text = answer.ToString();
        }
        else if (cosec == 1)
        {
            answer = 1 / Math.Sin(trig);
            textBox3.Text = answer.ToString();
        }
        else if (cot == 1)
        {
            answer = 1 / Math.Tan(trig);
            textBox3.Text = answer.ToString();
        }
        else if (des == 1)
        {
            textBox3.Text = ans.ToString();
        }
     
        else if (destohex == 1)
        {
            textBox3.Text = hexValue;
        }
        else if (oct == 1)
        {
            textBox3.Text = ans.ToString();
        }
        else if (bin == 1)
        {
            textBox3.Text = hexValue;
        }
        else if (squ == 1)
        {
            double a = Math.Pow(Convert.ToDouble(input1), 2);
            textBox3.Text = a.ToString();
        }
        else if (log == 1)
        {
            double a = Math.Log(trig);
            textBox3.Text = a.ToString();
        }
        }

        private void HexaRadioButton_CheckedChanged(object sender, EventArgs e)
        {
            destohex = 1;
            input1 = int.Parse(textBox3.Text);
            hexValue = input1.ToString("X");
          

          }

        private void OctalRadioButton_CheckedChanged(object sender, EventArgs e)
        {
            oct = 1;
            ans = Convert.ToInt32(textBox3.Text, 8);          
        }

        private void BinaryRadioButton_CheckedChanged(object sender, EventArgs e)
        {
            bin = 1;
            input1 = int.Parse(textBox3.Text);
            hexValue=Convert.ToString(input1,2);
        }
        private void DecimalRadioButton_CheckedChanged(object sender, EventArgs e)
        {
            des = 1;
            input1 = int.Parse(textBox3.Text);
            ans = m.BintoDecimal(input1);

        }

        private void AButton_Click(object sender, EventArgs e)
        {
            textBox3.Text += "A";
        }

        private void BButton_Click(object sender, EventArgs e)
        {
            textBox3.Text += "B";
        }

        private void CButton_Click(object sender, EventArgs e)
        {
            textBox3.Text += "C";
        }

        private void DButton_Click(object sender, EventArgs e)
        {
            textBox3.Text += "D";
        }

        private void EButton_Click(object sender, EventArgs e)
        {
            textBox3.Text += "E";
        }

        private void FButton_Click(object sender, EventArgs e)
        {
            textBox3.Text += "F";
        }

        private void BackspaceButton_Click(object sender, EventArgs e)
        {
          textBox3.Text = textBox3.Text.Remove(textBox3.Text.Length - 1, 1);
        }

        private void SquareButton_Click(object sender, EventArgs e)
        {
            squ = 1;
            input1 = Convert.ToInt32(textBox3.Text);
            textBox3.Text = "";
        }

        private void CosButton_Click(object sender, EventArgs e)
        {
            cos = 1;
            trig = Convert.ToDouble(textBox3.Text);
        }

        private void TanButton_Click(object sender, EventArgs e)
        {
            tan = 1;
            trig = Convert.ToDouble(textBox3.Text);
        }

        private void SecButton_Click(object sender, EventArgs e)
        {
            sec = 1;
            trig = Convert.ToDouble(textBox3.Text);
        }

        private void CotanButton_Click(object sender, EventArgs e)
        {
            cot = 1;
            trig = Convert.ToDouble(textBox3.Text);
        }

        private void CosecButton_Click(object sender, EventArgs e)
        {
            cosec = 1;
            trig = Convert.ToDouble(textBox3.Text);
        }

        private void LogButton_Click(object sender, EventArgs e)
        {
            log = 1;
            trig = Convert.ToDouble(textBox3.Text);
        }
    }

}