// con1.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include using namespace std; #define BASE 8 int ggg = 10; // global var int numberOfDigits(int n) { int i; int numD = 0; while (n != 0) { numD++; n /= 10; } ggg++; // will increase ggg to 11 return numD; } int main() { int inputNum, d; cin >> inputNum; // main sees the value of ggg as 10 here d = numberOfDigits(inputNum); // main sees the value of ggg as 11 here cout << "your number had " << d << " digits." << endl; return 0; }