online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
/****************************************************************************** Pietro Baima Number to letters ver 0.0 *******************************************************************************/ #include <stdio.h> #include <stdlib.h> #include <string.h> const char *zero[1]={"zero"}; const char *units[10] = {'\0',"uno","due","tre","quattro","cinque","sei","sette","otto","nove"}; const char *teens[10] = {"dieci","undici","dodici","tredici","quattordici","quindici","sedici","diciassette","diciotto","diciannove"}; const char *tens[10] ={'\0','\0',"venti","trenta","quaranta","cinquanta","sessanta","settanta","ottanta","novanta"}; const char *hundred[1]={"cento"}; int ntoITverbosen(int n, char* verbosen); int ntoITverbosen(int n, char* verbosen) { if (strlen(verbosen)==0 && n==0) {strcpy(verbosen, zero[0]);}; if (strlen(verbosen)!=0 && (n==1 || n==8) && verbosen[strlen(verbosen)-1]!='o') {verbosen[strlen(verbosen)-1]='\0';}; if (n>0 && n<10) {strcat(verbosen, units[n]);}; if (n>9 && n<20) {strcat(verbosen, teens[n-10]);}; if (n>19 && n<100) {strcat(verbosen, tens[n/10]);ntoITverbosen(n%10,verbosen);}; if (n>99 && n<1000) {if((n/100)!=1) strcpy(verbosen, units[n/100]);strcat(verbosen, hundred[0]);ntoITverbosen(n%100,verbosen);}; if (n>999) return (1); else return(0); } int main( int argc, char *argv[] ) { unsigned int n; char termcode; char *verbosen = malloc(1000); if( argc<2 ) { //no n printf("Usage: %s n[0 to 999]\n",argv[0]); return(2);} strcpy(verbosen, ""); n=atoi(argv[1]); if (n==-1) {for (int m=1;m<1000;m++) {ntoITverbosen(m,verbosen);printf("%d is: %s\n",m,verbosen);strcpy(verbosen, ""); };termcode=0;} else {termcode=ntoITverbosen(n,verbosen); if (!termcode) printf("%d is: %s\n",n,verbosen); else printf("huge number.\n");} free(verbosen); return(termcode); }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

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

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue