Results 1 to 4 of 4

Thread: Simple Calculator from C++

  1. #1
    arsfrun is offline Banned
    Join Date
    Jan 2011
    Posts
    24

    Default Simple Calculator from C++

    You can make simple calculator by this code

    Code:
    //Calculator by db.root
    #include <iostream>
    
    using namespace std;
    
    int choice;
    float a, b;
    float result;
    
    int main()
    {
      cout << "Welcome To Your Own Personal Calculator\n";
      cout << "Select Your Choice Of Operation From The Menu:\n\n";
      cout << "Enter [1] For Addition\n";
      cout << "Enter [2] For Subtraction\n";
      cout << "Enter [3] For Multiplication\n";
      cout << "Enter [4] For Division\n\n";
    
      cout << "Your Choice: ";
      cin >> choice;
    
       if (choice == 1) {
       cout << "Please Enter Your First Number: ";
       cin >> a;
       cout << "Please Enter Your Second Number: ";
       cin >> b;
       result = a + b;
       cout << "The Result Is: " << result;
        }
    
        if (choice == 2) {
       cout << "Please Enter Your First Number: ";
       cin >> a;
       cout << "Please Enter Your Second Number: ";
       cin >> b;
       result = a - b;
       cout << "The Result Is: " << result << endl;
    
        }
    
        if (choice == 3) {
       cout << "Please Enter Your First Number: ";
       cin >> a;
       cout << "Please Enter Your Second Number: ";
       cin >> b;
       result = a * b;
       cout << "The Result Is: " << result;
        }
    
        if (choice == 4) {
       cout << "Please Enter Your First Number: ";
       cin >> a;

  2. #2
    moonpeach is offline Junior Member
    Join Date
    Jan 2011
    Posts
    10

    Default

    Thank you very much for this , im sure this will come very handy

  3. #3
    Silver's Avatar
    Silver is offline Administrator
    Join Date
    Dec 2009
    Location
    GrowADollar
    Posts
    325

    Default

    I've never coded in c++ but dont C, C#, php, javascript and it's nice to see how all the languages have similar syntaxes. Once you know a syntax you can pretty much code anything.

  4. #4
    cyber1984 is offline Banned
    Join Date
    Mar 2010
    Posts
    2

    Default

    ya ya , good , now tell me how i program it into a hardware

Similar Threads

  1. Simple PHP redirect
    By arsfrun in forum Coding
    Replies: 0
    Last Post: 01-06-2011, 07:15 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •