online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
/****************************************************************************** Online C Compiler. Code, Compile, Run and Debug C program online. Write your code in this editor and press "Run" button to compile and execute it. *******************************************************************************/ #include <stdio.h> #include <math.h> #define rows 20 #define columns 100 void showleds(); void tilt(int level, int angel, int rotation); int my_array[rows][columns]; int main() { tilt(5,10,50); //tilt(int level, int angel, int rotation) showleds(); tilt(5,0,50); //tilt(int level, int angel, int rotation) showleds(); return 0; } void tilt(int level, int angel, int rotation){ for (int m = 0; m< rows; m++) { for (int i = 0; i< columns ; i++ ){ float xx = level + ((float)angel * fabs(sin( (M_PI* (float)rotation/(float)columns ) + 2 * M_PI * ((float)i/((float)columns*2.0f)))) - (float)angel/2.0f ); //printf("%f\n", xx); my_array[m][i] = xx > m; } } } void showleds() { for (int m = rows-1; m > 0; m--) { for (int i = 0; i< columns ; i++ ) if (my_array[m][i] == 0){ printf(" "); }else{ printf("#"); } printf("\r\n"); } }

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