The input is a three-digit number. Print the arithmetic mean of its digits

I have a homework assignment. The input is a three-digit number. Print the arithmetic mean of its digits. I am new to C++ and cannot write the code so that it takes 1 number as input to a string. I succeed, only in a column.

#include <iostream>
int main()
{
    int a,b,c;
    std::cin >> a >> b >> c;
    std::cout << (a+b+c)/3. << std::endl;
    return 0;
}

If you write it in Python it looks like this. But I don’t know how to write the same thing in C ++ 🙁

number = int(input())
digital3 = number % 10
digital2 = (number//10)%10
digital1 = number//100
summ = (digital1+digital2+digital3)/3
print(summ)

Answer

The most direct translation from Python differs mostly in punctuation and the addition of types:

#include <iostream>
int main()
{
    int number;
    std::cin >> number;
    int digital3 = number % 10;
    int digital2 = (number/10)%10;
    int digital1 = number/100;
    int summ = (digital1+digital2+digital3)/3;
    std::cout << summ << std::endl;
}