online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
#include <iostream> #include <cstring> using namespace std; char * itoa (int number, char *destination, int base) { int count = 0; do { int digit = number % base; destination[count++] = (digit > 9) ? digit - 10 + 'A' : digit + '0'; } while ((number /= base) != 0); destination[count] = '\0'; int i; for (i = 0; i < count / 2; ++i) { char symbol = destination[i]; destination[i] = destination[count - i - 1]; destination[count - i - 1] = symbol; } return destination; } int f (char *str, int i) { if (i == 0) return int (str[i]) - int ('0'); else return (int (str[i]) - int ('0')) *f (str, i - 1); } int main () { char str[3000000]; int t; while (cin >> str) { int count = 0; while (strlen (str) > 1) { int k = strlen (str) - 1; t = f (str, k); memset (str, 0, sizeof (str) / sizeof (str[0])); itoa (t, str, 10); count++; } cout << count << endl; } return 0; }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

  • {user}

      {timestamp}

    {content}

    #FunctionFile:Line
    VariableValue
    ExpressionValue