EngineersGarage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise
You are here: Home / Topics / C++ Programming for Simple Calculator

C++ Programming for Simple Calculator

|

Miscellaneous › Others › C++ Programming for Simple Calculator

  • This topic has 1 reply, 2 voices, and was last updated 15 years ago by Aftab Ahmad.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • May 12, 2011 at 7:14 am #925
    chelah
    Participant

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

    double result,m;                                             // The result of the calculations
    char oper_char,C;                                           // The user-specified operator
    double value;
                                                     // Value specified after the operator
    main()

    {

       result=0;
       clrscr ();                                             // Initialize the result
                                                                // Loop forever (or until break reached)
        while(1)
       {
            cout<<result;
            cin>>oper_char>>value;

            if((oper_char==’q’)||(oper_char==’Q’))
            break;
          clrscr ();
          switch(oper_char)
          {

         case ‘+’:
            result+=value;
            break;
             case ‘-‘:
            result-=value;
            break;
             case ‘*’:
            result*=value;
            break;
        case ‘/’:
        if(value==0)
                {
            cout<<“Error: Divide by zeron”;
            cout<<“Operation ignoredn”;
            }
                else
            result/=value;
                break;
             case ‘C’:
                cout<<result;
                break;

        default:
        cout<<“Unknown operator”<<oper_char<<‘n’;
        break;

        }

        }
       getch();
       return (0);
    }

     

     

     

     

    hello everyone!!.. will you all help me.. from above program… how we can put the coding for Memory Store (MS) and Memory Recall (MR) in C++ Calculator above….urgent… thanks all….. I’m using compiler software is Borland C++….

    May 18, 2011 at 8:09 pm #6277
    Aftab Ahmad
    Participant

    please send circuit diagram of calculator using 8052 microcontroller,

     

  • Author
    Posts
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Log In

RSS Recent Posts

  • reviving old swordfish program but? May 18, 2026
  • Assistance locating a 'trail' camera gadget, please ? May 18, 2026
  • Projector focus circuit May 18, 2026
  • Relay question May 18, 2026
  • Phone Charger 5v to 12v May 17, 2026

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2026 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise