We are doing a homework practicing our ability to write our own functions.

I need to find the order of magnitude of numbers inputted. According to the instructor, the OoM(50) = 1, OoM(100) = 2, OoM(3250)= 3, and so on.

So essentially, its scientific notation. 50 = 5.0 x 10^1

I cannot think of a way to code for this... I mean is it the 10th root of each number?

Hell, I know how to find the OoM on my own, I know how to write a damn function, but I can't figure out a way to solve this

Here's what I have coded so far:

Any help would be appreciated.Code:#include <cstdlib> #include <iostream> #include <cmath> using namespace std; int OoM(double number); /*takes a number inputted by the user and gives the user that number's order of magnitude*/ int main(int argc, char *argv[]) { double input_number; int result; //result will be the OoM of the number input cout << "Enter a number to find out it's order of magnitude:" << endl; cin >> input_number; result = OoM(input_number); cout << "The order of magnitude of " << input_number << " is:" << endl; cout << result << endl; system("PAUSE"); return 0; } int OoM(double number) { return (pow(number,(1/10))); // takes a user input number and takes the 10th root // returning this in int form gives us the OoM. Compiler gives warning // however we WANT this conversion of double to int because the OoM is always // an integer. The number you may be trying to find the OoM of could be of //type double, but it's OoM is always an int. }