online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
#include <stdio.h> #include <stdint.h> uint16_t tween(uint16_t); int main (){ uint16_t rpm; rpm=1000; rpm=tween(rpm); printf ("rpm = %d",rpm); return 0; } uint16_t tween(uint16_t rpm){ const uint16_t rpm_table[] = {0,800,1000,2000,3000,4000,5000,6000,7000,8000,65535}; const int16_t adj_table[] = {0,50,100,50,0,-50,-100,-100,-150,0,0}; uint16_t low,high; int16_t adjLow,adjHigh; int32_t adjust; uint8_t p=0; while(!(rpm<rpm_table[p+1])) p++; //p now points to the lower of the two rmp values it's between. low=rpm_table[p]; high=rpm_table[p+1]; adjLow=adj_table[p]; adjHigh=adj_table[p+1]; adjust=rpm-low; //how far into the triangle are we? adjust=adjust*(adjHigh-adjLow); //multiply by the height of the triangle adjust/=(high-low); //divide by the width of the triangle return(rpm+adjust+adjLow); }

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