C++ Programming Blog

 
 
 

Image

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

 main()
    {
       clrscr();

       int value_1;
       int value_2;
       int result;
       int unknown=0;

       char optr;

       cout<<\"\\n Enter the Value_1 = \";
       cin>>value_1;

       cout<<\"\\n Enter the operator ( optr ) = \";
       cin>>optr;

       cout<<\"\\n Enter the Value_2 = \";
       cin>>value_2;

       switch(optr)
      {
         case \'+\' : result=value_1+value_2;
            break;

         case \'-\' : result=value_1-value_2;
            break;

         case \'*\' : result=value_1*value_2;
            break;

         case \'/\' : result=value_1/value_2;
            break;

         default : cout<<\"\\n Unknown Operator \"<<endl;
               unknown=1;
      }

       if(unknown==0)
      cout<<\"\\n Result = \"<<result<<endl;

       getch();
       return 0;
    }

    Related Post:
  1. Program to convert an Infix Expression into a Postfix Expression using Linked List as a Stack

  2. Program to implement the Prims Algorithm to solve Minimum Spanning Tree Problem (MST) using Graphics

  3. Program that reads marks obtained by a student in a test of 100 marks and computes his grade

  4. Program to estimate the value of Fourth Derivative of the function at the given points from the given data using Central Difference Formula of order 4

  5. Program that performs SCANNING of the following program and finds the entire float,integer variables and keywords present in the program

  6. Program to illustrate the implementation of Double Ended linked list as a Queue

  7. Program to create heap

  8. Program that computes and display the square of first ten integers. (using for loop)

  9. Program to compute and print out the decimal notation for the reciprocal of each input integer

  10. Program that performs binary search

  11. Program that prints odd numbers, even numbers and the numbers that are divisible by 5 b/w 0 to 50

  12. Program to print an array before and after adding 5 to its contents using pointers

  13. Program to illustrate the relationship b/w union and structure

  14. Program to show the implementation of Cohen-Sutherland MidPoint Subdivision Line Clipping Algorithm

  15. Program to implement Add and Subtract function on Big Number Class

  16. Program to perform merge sort

  17. Program to print a histogram

  18. Program to construct Newtons Backward Difference Interpolation Formula from the given distinct equally spaced data points

  19. Program to illustrate the binary operator(-) overloading without creating an object of that class

  20. Program for Operator Overloading and Friend Function concept