Just editing my calculator and looking at what functions math.h had and i came across pow,
My program compiles and things like that so no error but if I'm not mistaken the answer is wrong.
6 ^ 1 = 6X6? = 36 (IS THAT CORRECT??)
JUST IN MY PROGRAM IF I USE 6^1 IT GIVES ME 1
#include <iostream>
#include <conio.h>
#include <math.h>
#include <stdio.h>
using namespace std;
#define PI 3.14159265
void binary(int);
int main()
{
system("TITLE My Calculator Program.");
system("COLOR C");
double firstNumber, secondNumber;
double resultSqrt, resultSin, resultCos, resultTan, resultBinary;
double resultPower;
char operation, boolSqrt;
cout << " *****************************************" << endl;;
cout << " Kizzop Productions - Simple Calculator!" << endl;;
cout << " *****************************************\n\n";
cout << " OPERATORS : +, -, *, /, !, ^, S, C, T, B" << endl;
cout << "\n";
cout << " + = ADD\n - = SUBTRACT\n * = Multiplication\n ";
cout << "/ = Division\n ! = SQAURE ROOT\n ^ = POWER\n S = SIN\n ";
cout << "C = COS\n T = TAN\n B = BINARY\n";
cout << " \n ************************************************" << endl;
cout << " NOTE : YOU CAN USE X AND x FOR MULTIPLICATION!" << endl;
cout << " ************************************************\n\n";
cout << "\n ENTER FIRST NUMBER : ";
cin >> firstNumber;
cout << "\n ENTER OPERATOR SIGN : ";
cin >> operation;
resultSqrt = sqrt (firstNumber);
resultPower = pow (firstNumber, secondNumber);
//resultBinary = binary (firstNumber);
resultSin = sin (firstNumber*PI/180);
resultCos = cos (firstNumber*PI/180);
resultTan = tan (firstNumber*PI/180);
switch(operation)
{
case '+':
cout << "\n ENTER SECOND NUMBER : ";
cin >> secondNumber;
cout << "\n Answer = " << (firstNumber + secondNumber);
break;
case '-':
cout << "\n ENTER SECOND NUMBER : ";
cin >> secondNumber;
cout << "\n Answer = " << (firstNumber - secondNumber);
break;
case '*':
case 'x':
case 'X':
cout << "\n ENTER SECOND NUMBER : ";
cin >> secondNumber;
cout << "\n Answer = " << (firstNumber * secondNumber);
break;
case '/':
cout << "\n ENTER SECOND NUMBER : ";
cin >> secondNumber;
cout << "\n Answer = " << (firstNumber / secondNumber);
break;
case '!':
cout << "\n ANSWER = " << resultSqrt;
break;
case '^':
cout << "\n TO THE POWER OF : ";
cin >> secondNumber;
cout << "\n ANSWER = " << resultPower;
break;
case 'S':
case 's':
cout << "\n ANSWER = " << resultSin;
break;
case 'C':
case 'c':
cout << "\n ANSWER = " << resultCos;
break;
case 'T':
case 't':
cout << "\n ANSWER = " << resultTan;
break;
case 'B':
case 'b':
cout << "\n ANSWER = " << resultBinary;
break;
default:
cout << "\n WRONG MATHEMATICAL OPERATOR!";
break;
}
system("PAUSE > nul");
}
/*
void binary(int number)
{
int remainder;
if( number <= 1 )
{
cout << number;
return;
}
remainder = number % 2;
binary (number >> 1);
cout << remainder;
}
*/