User Tag List

Results 1 to 5 of 5

Thread: My First Calculator In C++

  1. #1
    My First Calculator In C++

    User Info Menu

    My First Calculator In C++

    link of the program for those that want to use
    http://www.sendspace.com/file/4mhn8e

    heres the source code
    Code:
    //Bl4Ck.KiD...'s First Calculater In C++
    #include <cstdlib>
    #include <iostream>
     
    using namespace std;
     
    int main()
    {
        double num;//1st number 
        double num2;//2nd number
        char choice;//if u dont have cant chose wat u want
        for (;;){
         do {
        system("title Bl4Ck.KiD...'s Calculater");//Sets title up top of CMD, Took From DeToX Thanks
        system("color 69");//changes text color, took from DeToX Thanks
        cout<<"Welcome To Bl4Ck.KiD...'s Calculater\n";
        cout<<"Make Sure To Use It Eveytime You Have Math Homework!\n";//prints it at the top
        cout<<"Choose A Number What You Want To Do, Or Press q To Quit\n";//prints it at the top
        cout<<"MAKE SURE TO HIT ENTER WHEN YOU SELECT A NUMBER!!!\n";//prints it at the top
        cout<<"\n";//new line
        cout<<"1 - Addition\n";//add
        cout<<"2 - Subtraction\n";//sub
        cout<<"3 - Division\n";//divid
        cout<<"4 - Multiplication\n";//multi
        cout<<"5 - Info\n";//info
        cin>>choice;
        } while ( choice < '1' || choice > '5' && choice != 'q');//if u chose 1 th 5 or if u hit q it exits
        if (choice == 'q') break;//ends program
        switch (choice) {//switch bewteen choices
               case '1'://addition case
                    cout<<"\n";//new line
                    cout<<"Enter Your Number You Want To Added, Then Hit Enter\n";//prints text then goes down one with \n
                    cin>>num;//1st number 
                    cout<<"\n";//new line
                    cout<<"Enter Another Number To Get Added With It, Then Hit Enter To Get Anwser\n";//prints text then goes down one with \n
                    cin>>num2;//2nd number
                    cout<<"\n";//new line
                    cout<<num + num2;//adds both numbers together
                    cout<<"\n";//new line
                    break;//ends
               case '2'://subtraction case
                    cout<<"\n";//new line
                    cout<<"Enter Your Number You Want To Be Subtracted, Then Hit Enter\n";//prints text then goes down one with \n
                    cin>>num;//1st number 
                    cout<<"\n";//new line
                    cout<<"Enter Another Number To Get Subtracted With It, Then Hit Enter To Get Anwser\n";//prints text then goes down one with \n
                    cin>>num2;//2st number 
                    cout<<"\n";//new line
                    cout<<num - num2;//substracts both numbers
                    cout<<"\n";//new line
                    break;//ends
               case '3'://divid case 3
                    cout<<"\n";//new line
                    cout<<"Enter Your Number You Want To Be Divided, Then Hit Enter\n";//prints text then goes down one with \n
                    cin>>num;//1st number 
                    cout<<"\n";//new line
                    cout<<"Enter Another Number To Get Divided With It, Then Hit Enter To Get Anwser\n";//prints text then goes down one with \n
                    cin>>num2;//2st number 
                    cout<<"\n";//new line
                    cout<<num / num2;//divides both numbers
                    cout<<"\n";//new line
                    break;//ends
               case '4'://multiply case 4
                    cout<<"\n";//new line
                    cout<<"Enter Your Number You Want To Multiply, Then Hit Enter\n";//prints text then goes down one with \n
                    cin>>num;//1st number 
                    cout<<"\n";//new line
                    cout<<"Enter Another Number To Get Multiplied With It, Then Hit Enter To Get Anwser\n";//prints text then goes down one with \n
                    cin>>num2;//2nd number
                    cout<<"\n";//new line
                    cout<<num * num2;//multiples both numbers
                    cout<<"\n";//new line
                    break;//ends
               case '5'://info for case 5
                    cout<<"\n";//new line
                    cout<<"\n";//new line
                    cout<<"My First Calculater In C++ Nothing Special\n";//prints text then goes down one with \n
                    cout<<"Make Sure To Use It Eveytime You Have Math Homework :)\n";//prints text then goes down one with \n
                    cout<<"\n";//new line
                    cout<<"\n";//new line
                    cout<<"\n";//new line
                    break;//ends
               default://this will show up if u hit wrong button
                       cout<<"Not A Real Function, You Fail At Life :) ~BK";
                       cout<<"\n";//new line
                       cout<<"\n";//new line
                    }
    }
    return 0;
    }

  2. #2
    My First Calculator In C++

    User Info Menu

    Re: My First Calculator In C++

    Ha thats nice. The one i made is i just entered 2 numbers then it gave mult, add, sub, div, and square root of the 1 or 2 numbers. and you could put a third in. But yours using cases is much cleaner.

  3. #3
    My First Calculator In C++

    User Info Menu

    Re: My First Calculator In C++

    Quote Originally Posted by Scal24 View Post
    Ha thats nice. The one i made is i just entered 2 numbers then it gave mult, add, sub, div, and square root of the 1 or 2 numbers. and you could put a third in. But yours using cases is much cleaner.
    i should have did square root idk if i feel like it ill go tho an add it

  4. #4
    My First Calculator In C++

    User Info Menu

    Re: My First Calculator In C++

    It's funny how JinzoX/TheEliteOne just posted another version of this on Uni... I think it was in batch but I could honestly care less. You did it a different way. =D. We all need some inspiration. Good job, and KIU. Perhaps you could add some: "system("cls");" makes it look much less sloppy.
    Last edited by S2h6699; 04-09-2010 at 10:55 PM.
    Quote Originally Posted by Epic of HITB
    get... 1) a mini fridge | 2) A toilet installed in your room | 3) a closet full of non-perishable foods | 4) Lyscol ( who needs showers anyway?) | 5) tons of books articles lectures zines etc etc

    Dont leave your room...EVER... AND I MEAN EVER
    Damned six line limit! *NERD RAGE*

  5. #5
    My First Calculator In C++

    User Info Menu

    Re: My First Calculator In C++

    Quote Originally Posted by S2h6699 View Post
    It's funny how JinzoX/TheEliteOne just posted another version of this on Uni... I think it was in batch but I could honestly care less. You did it a different way. =D. We all need some inspiration. Good job, and KIU. Perhaps you could add some: "system("cls");" makes it look much less sloppy.
    i set this up based off my cheat device if u notice how it use cases like my prx if u ever saw the bakon ice src

Tags for this Thread

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
  •