MetalheadGautham
AFK
Turbo Calc 15000
This is a basic calculator compiled using GCC, but first written using Borland's Turbo C++ IDE 3.0, hence called turbo calc. It has 15 functions, hence 15000
PS: I am a rookie C++ programmer. I had learnt C in the begening of class 6(lol) but forgot it(lol again)
I made this because I just wanted to try something that looks usable. Please excuse my n00bishness
I regret the fact that we have only Turbo C++ in CBSE senior secondary scyllabus. Anjuta IDE and Dev-Cpp along with MinGW Developer Studio are forgotton. CBSE I suppose, is full fo linux haters.
TURBO CALC 15000
This is a basic calculator compiled using GCC, but first written using Borland's Turbo C++ IDE 3.0, hence called turbo calc. It has 15 functions, hence 15000
Code:
/*
Turbo Calc 11000 Coppyright(c) Gautham T
This is freeware, use this software as you
like, but the author must be attributed to
when making derivatives. This source code may
also be distributed with it. Its delivered under
GNU GPL Version 3, a coppy of which may be found in
www.gnu.org . This software is Designed to
illustrate some basic operations with C++
and it uses Turbo C++ IDE 3.0 for compiling
although source code is easily ported to
other platforms.
*/
#include<iostream.h>
#include<math.h>
/* iostream.h for basic operations
conio.h for clrscr()
math.h for many of the calculator's functions */
int main() //calculator function
{
long double a,b; //the two operants
unsigned short int c; //choice
cout<<"This is turbocalc 11000, your best choice for a"<<endl;
cout<<"simple and robust x86 platform based calculator."<<endl<<endl;
cout<<"Type 1 for addition;"<<endl; //add
cout<<"Type 2 for subtraction;"<<endl; //sub
cout<<"Type 3 for multiplication;"<<endl; //multi
cout<<"Type 4 for dividion;"<<endl; //div
cout<<"Type 5 for finding the Square;"<<endl; //square
cout<<"Type 6 for finding the Cube;"<<endl; //cube
cout<<"Type 7 for finding the square root;"<<endl; //root
cout<<"Type 8 for finding the sine;"<<endl; //sin
cout<<"Type 9 for finding the cosine;"<<endl; //cos
cout<<"Type 10 for finding the tangent;"<<endl; //tan
cout<<"Type 11 for finding the seccant;"<<endl; //sec
cout<<"type 12 for finding the coseccant;"<<endl; //cosec
cout<<"Type 13 for finding the cotangent;"<<endl; //cot
cout<<"Type 14 for finding the natural logarithm;"<<endl; //log
cout<<"Type 15 for finding the logarithm to base 10."<<endl; //log10
cin>>c; //got the choice now
if ((c==1)||(c==2)||(c==3)||(c==4))
{
cout<<"Enter the first number:"<<endl;
cin>>a;
cout<<endl<<endl<<"Enter the second number:"<<endl;
cin>>b;
}
else if((c==5)||(c==6)||(c==7)||(c==8)||(c==9)||(c==10)||(c==11)||(c==12)||(c==13)||(c==14)||(c==15))
{
cout<<"enter the number: "<<endl;
cin>>a;
}
else
{
cout<<"You must only enter a number from 1 to 15."<<endl;
}
if (c==1)
cout<<"The Sum is "<<a+b<<endl;
else if (c==2)
cout<<"The Difference is "<<a-b<<endl;
else if (c==3)
cout<<"The Product is "<<a*b<<endl;
else if (c==4)
cout<<"The Quotient is "<<a/b<<endl;
else if (c==5)
cout<<"The Square is "<<a*a<<endl;
else if (c==6)
cout<<"The Cube is "<<a*a*a<<endl;
else if (c==7)
cout<<"The Square Root is "<<sqrt(a)<<endl;
else if (c==8)
cout<<"The Sine is "<<sin(a)<<endl;
else if (c==9)
cout<<"The Cosine is "<<cos(a)<<endl;
else if (c==10)
cout<<"The Tangent is "<<tan(a)<<endl;
else if (c==11)
cout<<"The Seccant is "<<1/(cos(a))<<endl;
else if (c==12)
cout<<"The Coseccant is "<<1/(sin(a))<<endl;
else if (c==13)
cout<<"The Cotangent is "<<1/(tan(a))<<endl;
else if (c==14)
cout<<"The Natural Logarithm is "<<log(a)<<endl;
else if (c==15)
cout<<"The Logarithm to base 10 is "<<log10(a)<<endl;
else
cout<<"There must be an error in what you typed."<<endl<<"Try Again.";
return 0;
}
I made this because I just wanted to try something that looks usable. Please excuse my n00bishness
I regret the fact that we have only Turbo C++ in CBSE senior secondary scyllabus. Anjuta IDE and Dev-Cpp along with MinGW Developer Studio are forgotton. CBSE I suppose, is full fo linux haters.