+ 2

What is the symbol for power?

What operator should we use to get a power of some no. Like I want to get 10^5. How can I get this in C++

17th Jul 2018, 7:01 PM
Mukul
Mukul - avatar
5 Answers
+ 2
C++ does not have an operator for that operation. Either you make yourself your own function, or use the preexisting pow() function: http://www.cplusplus.com/reference/cmath/pow/
17th Jul 2018, 7:09 PM
Shadow
Shadow - avatar
+ 4
cond() tests if a character is a digit, right? Why not use the built-in C++ function, saves you some work: http://www.cplusplus.com/reference/cctype/isdigit/ Same goes for num(), C++ has built-in functions for convertions from string/char to number: http://www.cplusplus.com/reference/cstdlib/ You should have a look in the different headers grouped in the STL, they can save you a lot of work in future projects: http://www.cplusplus.com/reference/ https://en.cppreference.com/w/cpp
17th Jul 2018, 9:00 PM
Shadow
Shadow - avatar
+ 2
Thanq Naitomea
17th Jul 2018, 7:11 PM
Mukul
Mukul - avatar
+ 1
Thanq you actually I was making this program of factorial calc. https://code.sololearn.com/cyfjqbS4X5BC/?ref=app Plz guyz upvote if you like. And if you find a mistake or have a better idea. Plz tell me.
17th Jul 2018, 8:33 PM
Mukul
Mukul - avatar
0
Thanq you Naitomea I have not quite reached this topic yet.
29th Jul 2018, 4:35 PM
Mukul
Mukul - avatar