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

1 comment:

  1. Programming is combination of intelligent and creative work. Programmers can do anything with code. The entire Programming tutorials that you mention here on this blog are awesome. Beginners Heap also provides latest tutorials of Programming from beginning to advance level.
    Be with us to learn programming in new and creative way.

    ReplyDelete