online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
int ptoi(char *percent){ char i=0; int num=0; while(percent[i]>='0'&&percent[i]<='9') num=num*10+percent[i++]-0x30; if(percent[i]=='.'){ if(percent[i+1]>='5'&&percent[i+1]<='9') num++; } return(num); } int main() { printf("Percent 23.123 = %i\n",ptoi("23.123")); printf("Percent 23.567 = %i\n",ptoi("23.567")); 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}