online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
#include <stdio.h> #include "math.h" #define OBSERVATION 7 #define MEDIAN 34 int main() { int iDifference = 0; printf("Insert the patient's temperature over the course of 7 days:\n"); float temp[OBSERVATION] = { 37.4f, 36.2f, 31.5f, 33.6f, 38.2f, 34, 33.9 }; printf("DAY\tVALUE\tISTOGRAM\n"); for(int i = 0; i < OBSERVATION; i++){ // calculate the difference integer iDifference = round(temp[i] - MEDIAN); // don't add stars if the temperature diff is lower than 0 if(iDifference < 0) iDifference = 0; // print the first two columns, notice that the new line isn't added yet printf("%6d\t%6.2f\t", i, temp[i]); // print the stars vDrawStars(iDifference); // then write the newline character printf("\n"); } return 0; } void vDrawStars(int prm_iCount){ int p = 0; // I didn't understand the case for it but // printf("\t\t\t\t"); // then draw the needed stars for(p = 0; p < prm_iCount; p++) { printf("*"); } // no new lines, still on the same line. }

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