Wednesday 13 June 2012

how to make a calculator using c++

c++ calculator source code

This is the source code for making basic calculator in c++

#include<iostream.h>
#include<conio.h>
main()
{
      float x,y;
      char op;
      cout<<"enter first value,arithematic operator and second value:";
      cin>>x>>op>>y;
      if(op=='+')
      cout<<x+y;
      else if(op=='-')
      cout<<x-y;
      else if(op=='*')
      cout<<x*y;
      else if(op=='/')
      cout<<x/y;
      else 
      cout<<"invalid operator %%%%%%%%%";
      getch();
      }
End
c++ calculator source code

2 comments:

  1. thank you for sharing nice article in your blog
    visit
    web programming tutorial
    welookups

    ReplyDelete

  2. nice article for beginners.thank you.
    javacodegeeks

    ReplyDelete