mirror of
https://hub.njuu.cf/TheAlgorithms/C-Plus-Plus.git
synced 2023-10-11 13:05:55 +08:00
Resolve typo errors
This commit is contained in:
parent
a82e679f2e
commit
8219e124a7
@ -31,7 +31,7 @@ int binExpo(int a, int b) {
|
||||
/// Iterative function to calculate exponent in O(log(n)) using binary exponent.
|
||||
int binExpo_alt(int a, int b) {
|
||||
int res = 1;
|
||||
while (b>0) {
|
||||
while (b > 0) {
|
||||
if (b%2) {
|
||||
res = res*a;
|
||||
}
|
||||
@ -45,9 +45,9 @@ int main() {
|
||||
int a, b;
|
||||
/// Give two numbers a, b
|
||||
std::cin >> a >> b;
|
||||
if (a==0 && b==0) {
|
||||
if (a == 0 && b == 0) {
|
||||
std::cout << "Math error" << std::endl;
|
||||
} else if (b<0) {
|
||||
} else if (b < 0) {
|
||||
std::cout << "Exponent must be positive !!" << std::endl;
|
||||
} else {
|
||||
int resRecurse = binExpo(a, b);
|
||||
|
Loading…
Reference in New Issue
Block a user