I am having trouble with line 13 ( int numberOfDigits =....) im getting a "type double unexpected" message. I'm pretty sure its something small, but im new to c++. any assistance would help
Code:
#include <iostream>
#include <cmath>
using namespace std;
int main(){
//Read in
cout << "Enter an interger strictly between 0 and 1000: ";
int number;
cin >> number;
//Calculations
int numberOfDigits = double ceil(log10(number + 0.1));
int lastDigit = number % 10;
number = number / 10;
int secondLastDigit = number % 10;
number = number / 10;
int thirdLastDigit = number % 10;
number = number / 10;
int sumOfDigits = lastDigit + secondLastDigit + thirdLastDigit;
int averageOfDigits = (lastDigit + secondLastDigit + thirdLastDigit) / 3;
//Read out
cout << "The sum of the digits is " << sumOfDigits << endl;
cout << "The average of the digits is " << averageOfDigits << endl;
cout << "The number of digits is " << numberOfDigits << endl;
return 0;
}