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;
}
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.
Re: My First Calculator In C++
Quote:
Originally Posted by
Scal24
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
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.
Re: My First Calculator In C++
Quote:
Originally Posted by
S2h6699
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