#include <math.h>
#include <iostream>
#include <string>
int int1, int2, answer;
bool bValue( true ) ;
std:: string oper;
std:: string cont;
using namespace std;
std:: string typeOfMath;
int a;
int b;
int answerExponent;
int main( int argc, const char * argv[ ] )
{
// Taking user input, the first number of the calculator, the operator, and second number. Addition, Substraction, Multiplication, Division
cout << "______________________________________________\n " ;
cout << "|Welcome to The ExpCalc! Do you want to do |\n " ;
cout << "|Exponent Math, or Basic Math(+, -, X, %) |\n " ;
cout << "|Type in 'B' for basic Math, and'E' for |\n " ;
cout << "|Exponential Math! Enjoy! (C) John L. Carveth|\n " ;
cout << "|____________________________________________|\n " ;
cin >> typeOfMath;
if ( typeOfMath == "Basic" ||
typeOfMath == "basic" ||
typeOfMath == "b" ||
typeOfMath == "B" )
{
cout << "Hello! Please Type in your first integer!\n " ;
cin >> int1;
cout << "Great! Now Enter your Operation: ex. *, /, +, -...\n " ;
cin >> oper;
cout << "Now all we need is the last int!\n " ;
cin >> int2;
if ( oper == "+" ) {
answer = int1 + int2;
}
if ( oper == "-" ) {
answer = int1 - int2;
} if ( oper == "*" ) {
answer = int1 * int2;
} if ( oper == "/" ) {
answer = int1 / int2;
}
cout << answer << "\n " ;
cout << "Thanks for Using The ExpCalc!\n " ;
}
else if ( typeOfMath == "Exp" || typeOfMath == "E" || typeOfMath == "e" || typeOfMath == "Exponent" ) {
cout << "Enter the desired Base. Example: 2^3, where 2 is the base.\n " ;
cin >> a;
cout << "Now what is the desired exponent/power of the base? Ex. 2^3 where 3 is the exponent!\n " ;
cin >> b;
answerExponent = ( pow ( a,b) ) ;
cout << answerExponent;
} else ( cout << "Wrong String!" ) ;
}
I2luY2x1ZGUgPG1hdGguaD4KI2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3RyaW5nPgppbnQgaW50MSwgaW50MiwgYW5zd2VyOwpib29sIGJWYWx1ZSh0cnVlKTsKc3RkOjpzdHJpbmcgb3BlcjsKc3RkOjpzdHJpbmcgY29udDsKdXNpbmcgbmFt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GVyYXRpb246IGV4LiAqLCAvLCArLCAtLi4uXG4iOwpjaW4+PiBvcGVyOwpjb3V0PDwiTm93IGFsbCB3ZSBuZWVkIGlzIHRoZSBsYXN0IGludCFcbiI7CmNpbj4+IGludDI7CgppZiAob3BlciA9PSAiKyIpIHsKICAgIGFuc3dlciA9IGludDEgKyBpbnQyOwp9CmlmIChvcGVyID09ICItIikgewogICAgYW5zd2VyID0gaW50MSAtIGludDI7Cgp9aWYgKG9wZXIgPT0gIioiKSB7CiAgICBhbnN3ZXIgPSBpbnQxICogaW50MjsKfWlmIChvcGVyID09ICIvIikgewogICAgYW5zd2VyID0gaW50MSAvIGludDI7Cn0KY291dDw8YW5zd2VyIDw8ICJcbiI7CmNvdXQ8PCJUaGFua3MgZm9yIFVzaW5nIFRoZSBFeHBDYWxjIVxuIjsKCgp9CgoKCiAgICBlbHNlIGlmKHR5cGVPZk1hdGggPT0gIkV4cCIgfHx0eXBlT2ZNYXRoID09ICJFIiB8fHR5cGVPZk1hdGggPT0gImUiIHx8dHlwZU9mTWF0aCA9PSAiRXhwb25lbnQiKXsKICAgICAgICBjb3V0PDwiRW50ZXIgdGhlIGRlc2lyZWQgQmFzZS4gRXhhbXBsZTogMl4zLCB3aGVyZSAyIGlzIHRoZSBiYXNlLlxuIjsKICAgICAgICBjaW4+PiBhOwogICAgICAgIGNvdXQ8PCJOb3cgd2hhdCBpcyB0aGUgZGVzaXJlZCBleHBvbmVudC9wb3dlciBvZiB0aGUgYmFzZT8gRXguIDJeMyB3aGVyZSAzIGlzIHRoZSBleHBvbmVudCFcbiI7CiAgICAgICAgY2luPj5iOwogICAgICAgIGFuc3dlckV4cG9uZW50ID0gKHBvdyhhLGIpKTsKICAgICAgICBjb3V0PDwgYW5zd2VyRXhwb25lbnQ7CiAgICB9IGVsc2UoY291dDw8Ildyb25nIFN0cmluZyEiKTsKfQ==
stdout
______________________________________________
|Welcome to The ExpCalc! Do you want to do |
|Exponent Math, or Basic Math(+, -, X, %) |
|Type in 'B' for basic Math, and'E' for |
|Exponential Math! Enjoy! (C) John L. Carveth|
|____________________________________________|
Enter the desired Base. Example: 2^3, where 2 is the base.
Now what is the desired exponent/power of the base? Ex. 2^3 where 3 is the exponent!
8