Pages

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();
        }

    }
}


Saturday, October 31, 2015

iPhone 6s Plus vs Galaxy Note 5 Comparison



As we’ve come to expect from Apple’s S models, the iPhone 6s Plus doesn’t look dramatically different to the iPhone 6 plus: the design still feels fresh though, and we’re sure the new rose gold option will have plenty of fans. It appears to be another well-built Apple device and this year’s model is tougher than before, made from stronger aluminum to ensure it doesn’t go banana-shaped if you sit on it.

The Galaxy Note 5 is better than its predecessor, with a glass and metal case that gets shot of the horrible fake-leather of its predecessor, and we think it's a fine looker. The Note 5 also has Samsung's S Pen, which many people find useful, although some people choose not to use it. There does appear to be one design problem though: as you’ve probably heard by now, putting the S Pen in the wrong way can cause serious damage to the Note.

Display

The iPhone 6s Plus has the same 5.5-inch display as the 6 Plus, with 1920-by-1080-pixel resolution and 401 ppi. The important difference in the display is the implementation of Apple's 3D Force Touch technology, a pressure-sensing system similar to the one in recent MacBook’s and the Apple Watch. It doesn’t just detect taps, but presses and long presses too, and is baked right into Apple’s operating system.

The Note 5 has a 5.7-inch AMOLED display running 2,560 x 1,440 pixels at 515 ppi. It’s one of the best displays ever fitted to a mobile device and it’s particularly good if you like your colors to pop and zing. It’s denser than the iPhone display, and brighter without being oversaturated like earlier AMOLEDS were. 

Processor & Storage

The iPhone 6s Plus comes with the new 64-bit A9 processor with an M9 motion co-processor. A direct comparison with Android devices isn’t really possible here because Apple’s control of hardware and OS means it can optimize its devices in a way Android firms can’t.

The Galaxy Note 5 has Samsung’s own Exynos 7420 processor, running eight cores at up to 2.1 GHz, and it’s backed with 4 GB of RAM and either 32 GB or 64 GB of on-board storage.

Camera

Apple has long concentrated on image quality rather than mere megapixels, but with the iPhone 6s plus the megapixel count is up from 8 MP to 12 MP, while retaining the optical image stabilization of the previous Plus. The front-facing snapper comes in at 5 MP, with the display now acting as a flash.

The Note 5 has one of the best cameras around. It’s a very impressive 16 MP shooter with LED flash, image stabilization and excellent low light performance. The front facing camera is 5 MP. On paper, then, the Note camera is better, but if Apple has worked its usual magic with the camera sensor there’s a good chance the iPhone 6s plus may still take the better photos. 

Battery

The iPhone 6s Plus battery comes in at 2,750 mAh, a little smaller than the iPhone 6 Plus' 2,915 mAh. That may be compensated by iOS 9’s power management and what we assume is a more efficient processor, as the likelihood of Apple releasing an iPhone with worse battery life than before seems rather small.

The Note 5 has a 3,000 mAh battery and unlike Apple, it supports fast charging and fast wireless charging. However in the real world we expect both devices to deliver a day’s battery life in normal usage.


Tuesday, October 13, 2015

Code of How to calculate under root in C#

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

namespace ConsoleApplication4
{
    class Program
    {
        static void Main(string[] args)
        {
            int low = 0;
            int n,ans,high = 0;
            Console.Write("Enter the value of n for the underroot : ");
            n=int.Parse(Console.ReadLine());
           // high = n;
            for(int i=0;i<=n;i++)
            {
                low += 1;
                high += 1;
                ans = low * high;
                if(ans==n && low==high)
                {
                    Console.Write("the squareroot is : ");
                    Console.WriteLine(low);
                }
                else
                {
                    continue;
                }
            }
            Console.ReadLine();
            
        }
    }
}

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();
}


Monday, July 27, 2015

Code For Maintaining a Telephone Directory In C++

#include <iostream.h>
#include <fstream.h>
#include <string.h>
#include <iomanip.h>
#include <conio.h>

class phoneBook{
    char name[20],phno[6];
    public:
    void getdata();
    void showdata();
    char *getname(){ return name; }
    char *getphno(){ return phno; }
    void update(char *nm,char *telno){
        strcpy(name,nm);
        strcpy(phno,telno);
    }
};

void phoneBook :: getdata(){
    cout<<"\nEnter Name : ";
    cin>>name;
    cout<<"Enter Phone No. : ";
    cin>>phno;
}

void phoneBook :: showdata(){
    cout<<"\n";
    cout<<setw(15)<<name;
    cout<<setw(8)<<phno;
}


void main(){
    phoneBook rec;
    fstream file;
    file.open("c:\\phone.dat", ios::ate | ios::in | ios::out | ios::binary);
    char ch,nm[20],telno[6];
    int choice,found=0;
    while(1){
        clrscr();
        cout<<"\n*****Phone Book*****\n";
        cout<<"1) Add New Record\n";
        cout<<"2) Display All Records\n";
        cout<<"3) Search Telephone No.\n";
        cout<<"4) Search Person Name\n";
        cout<<"5) Update Telephone No.\n";
        cout<<"6) Exit\n";
        cout<<"Choose your choice : ";
        cin>>choice;
        switch(choice){
            case 1 : //New Record
                 rec.getdata();
                 cin.get(ch);
                 file.write((char *) &rec, sizeof(rec));
                 break;

            case 2 : //Display All Records
                 file.seekg(0,ios::beg);
                 cout<<"\n\nRecords in Phone Book\n";
                 while(file){
                    file.read((char *) &rec, sizeof(rec));
                    if(!file.eof())
                        rec.showdata();
                 }
                 file.clear();
                 getch();
                 break;

            case 3 : //Search Tel. no. when person name is known.
                 cout<<"\n\nEnter Name : ";
                 cin>>nm;
                 file.seekg(0,ios::beg);
                 found=0;
                 while(file.read((char *) &rec, sizeof(rec)))
                 {
                    if(strcmp(nm,rec.getname())==0)
                    {
                        found=1;
                        rec.showdata();
                    }
                 }
                 file.clear();
                 if(found==0)
                    cout<<"\n\n---Record Not found---\n";
                 getch();
                 break;

            case 4 : //Search name on basis of tel. no
                 cout<<"\n\nEnter Telephone No : ";
                 cin>>telno;
                 file.seekg(0,ios::beg);
                 found=0;
                 while(file.read((char *) &rec, sizeof(rec)))
                 {
                    if(strcmp(telno,rec.getphno())==0)
                    {
                        found=1;
                        rec.showdata();
                    }
                 }
                 file.clear();
                 if(found==0)
                    cout<<"\n\n---Record Not found---\n";
                 getch();
                 break;

            case 5 : //Update Telephone No.
                 cout<<"\n\nEnter Name : ";
                 cin>>nm;
                 file.seekg(0,ios::beg);
                 found=0;
                 int cnt=0;
                 while(file.read((char *) &rec, sizeof(rec)))
                 {
                    cnt++;
                    if(strcmp(nm,rec.getname())==0)
                    {
                        found=1;
                        break;
                    }
                 }
                 file.clear();
                 if(found==0)
                    cout<<"\n\n---Record Not found---\n";
                 else
                 {
                    int location = (cnt-1) * sizeof(rec);
                    cin.get(ch);
                    if(file.eof())
                        file.clear();

                    cout<<"Enter New Telephone No : ";
                    cin>>telno;
                    file.seekp(location);
                    rec.update(nm,telno);
                    file.write((char *) &rec, sizeof(rec));
                    file.flush();
                 }
                 break;
            case 6 : gotoout;
        }
    }
out:
file.close();
}


Tuesday, June 23, 2015

Program to Implement Linear Search Algorithm

#include<iostream.h>
#include<constream.h>
void read(int a[10],int n)
{
                cout<<"reading\n";
                for(int i=0;i<n;i++)
                                cin>>a[i];
}
void display(int a[10],int n)
{
                for(int i=0;i<n;i++)
                                cout<<a[i]<<"\t";
}
void linearsearch ( int a[10],int n  )
{
                int k,flag=0;
                read(a,n);
                display(a,n);
                cout<<"\nenter an element to be search\n";
                cin>>k;
                for(int i=0;i<n;i++)
                {
                                if(a[i]==k)
                                                flag=1;
                                break;
                }
                if(flag==1)
                                cout << "\nsearching is  successful,element is found at position " << i +1<<endl;
                else
                                cout<<"searching not successful\n";
}
void main()
{
                int a[10], n;
                clrscr();
                cout<<"enter n value..\n";
                cin>>n;
                linearsearch(a,n);
                getch();
}


Saturday, June 20, 2015

How to Use Key Event Args in C#


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 _10._1_keyboard
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_KeyDown(object sender, KeyEventArgs e)
        {
            label1.Text = "Alt " + (e.Alt ? "Yes" : "No") + "\n" + " Shift"
                + (e.Shift ? " Yes" : "No") + " Ctrl " + (e.Control ? " Yes" : " No")
                + "\n" + "Key Code " + e.KeyCode + "\n" + "Key Value "
                + e.KeyValue + "\n" + "Key Data " + e.KeyData + "\n";

           
        }
    }
}



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();
        }
    }

}

Thursday, June 18, 2015

How To Create Array of Structures

#include <iostream>
#include <string>
#include<conio.h>
#include <sstream>
using namespace std;

struct movies_t {
  string title;
  int year;
} films [3];

void printmovie (movies_t movie);

int main ()
{
  string mystr;
  int n;

  for (n=0; n<3; n++)
  {
    cout << "Enter title: ";
    getline (cin,films[n].title);
    cout << "Enter year: ";
    getline (cin,mystr);
    stringstream(mystr) >> films[n].year;
  }

  cout << "\nYou have entered these movies:\n";
  for (n=0; n<3; n++)
    printmovie (films[n]);
  return 0;
}

void printmovie (movies_t movie)
{
  cout << movie.title;
  cout << " (" << movie.year << ")\n";
}

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();
            
        }
    }
}

Monday, June 15, 2015

A C# Program To Explain Get Set Accessor


using System;

namespace Example2
{
  class input
   {
     private static int num1, num2, result;
     public void add()
      {
        result = num1 + num2;
        Console.WriteLine("\n\nAdd = {0}", result);
        Console.ReadLine();
      }

     // Creating property for storing value in num1
     public int Number1
      {
        get
         {
           return num1;
         }
        set
         {
           num1 = value;
         }
      }

     // Creating property for storing value in num2
     public int Number2
      {
        get
         {
           return num2;
         }
        set
         {
           num2 = value;
         }
      }
   }

  class Program
   {
     static void Main(string[] args)
      {
        input inp = new input();
        Console.Write("Enter number 1st:\t");
        inp.Number1 = Convert.ToInt32(Console.ReadLine());

        Console.Write("Enter number 2nd:\t");
        inp.Number2 = Convert.ToInt32(Console.ReadLine());

        inp.add();
      }
   }
}