Hello all, I was wondering how I could make this with larger numbers instead of scientific notation or whatever it is. I have attached my code and here is what I did:

1. Typed in E for exponent and hit enter.

2. Entered 9 and hit enter.

3. Entered 9 so it can be 9 to the 9th power and hit enter.

4. and it came up with this: 3.8742e+008

I want it to be like a real calculator so it can be: 387420489

Thank you everyone for all your help.

Gangsta gama

Perhaps you should define a double variable like double p;, then do p= pow(Ex,Ey) and cout << p?

1. Fixed (not scientific) notation, no fractional part:

#include <iomanip>
...
cout << fixed << setprecision(0) << pow(Ex,Ey) << endl;

2. Use double for Ex. Ey, Sx, Sy. Declare these variables locally (in functions), no need in global scope. Don't capitalize ordinal variable names...
3. Delete all irrelevant and nonportable system("CLS") calls. Don't use system("pause") too, add cin.get() to wait user input.
4. It's illegal in C and C++ to call main recursively. Don't use recursion for "try again" calls of other calculations. Better define a special function to ask user for repetitive calc, for example:

bool tryAgain()
{
    cout << "Try again (y/n)\? " << flush;
    char answer;
    cin >> answer;
    cin.ignore(1000,'\n');
    return answer == 'y' || answer == 'Y';
}

Let exponent and squareRoot functions ask user to get arguments and print result only:

do
    exponent();
while (tryAgain());

Use the same approach in the main dialog loop (not recursion!)...
5. Correct these funny trailed elseif:

if (answer == 'y' || answer == 'Y')
...
     else if (answer != 'y' || answer != 'Y')

It seems you don't understand the meaning of else clause. Keep it simpler (and correctly):

if (answer == 'y' || answer == 'Y')
   ... yes, yes...
else
   ... NOT yes, no, no

Apropos, else (no) condition is answer != 'y' && answer != 'Y' ...
6. What compiler are you using? In modern C++ you must include <iostream>...

Ooh! Is it all?;)..

Thank you, ArkM.

I will try what you did. The compiler I am using is Dev c++ and it is not working right now, so that is why I am writing back. I have one question though... what does setprecision do?

Thank you,
Gangsta Gama

Thank you, ArkM.

I will try what you did. The compiler I am using is Dev c++ and it is not working right now, so that is why I am writing back. I have one question though... what does setprecision do?

Thank you,
Gangsta Gama

Best way to learn is to run the example and experiment with the numbers and see what happens.

http://www.cplusplus.com/reference/iostream/manipulators/setprecision.html

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.