online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
#include <iostream> using namespace std; int main() { int a[8]={13, 44, 75, 100, 120, 275, 325, 510}; int clave=275; int n=sizeof(a)/sizeof(int); int central, bajo, alto; int valorCentral; bajo = 0; alto = n - 1; while (bajo <= alto) { central = (bajo + alto)/2; // índice de elemento central valorCentral = a[central]; // valor del índice central if (clave == valorCentral) { cout<<central<<endl; // encontrado, devuelve posición break; } else if (clave < valorCentral) alto = central - 1; // ir a sublista inferior else bajo = central + 1; // ir a sublista superior } 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.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue