0

```
//Hi,i need to create programm,which takes the user input,determins how many digits in integer
// and than raise this digit to power,what was entered by user too.
//first function noraml,second one to rais to power recursive. So if user enter number
//234,this is 3 digits,so now need recurcively 3 raise to the power .
// This what i got so far program determins the digits from integer,but does not use power
// Power of size number.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include<string>
using namespace std;
typedef long double ld;
int countDigits(int number) {
if (number < 10) {
return 1;
}
int count = 0;
while (number > 0) {
number /= 10;
count++;
}
return count;
}
int place(ld,ld);
// testing the countDigits function
int main() {
int num ;
int result;
int exp;
cout << "enter number: "<<endl;
cin >> num;
cout << "Enter exponent: " << endl;
cin >> exp;
int numDigits = countDigits(num);
cout << num << " has " << numDigits << " digits" << endl;
result = place(numDigits,exp);
cout << result;
return 0;
}int place(ld numDigits,ld exp)
{
if(exp >=10)
{
return
numDigits*(place(numDigits,exp-1));
}
else
return 1;
}
```

*Edited 2 Years Ago by aluhnev*