online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
#include <iostream> #include <chrono> #define NUM_ITERATIONS 10000000000 int main() { // Block 1: one operation in loop body { int64_t x = 0, y = 0; auto start = std::chrono::high_resolution_clock::now(); for (long i = 0; i < NUM_ITERATIONS; i++) {x+=31;} auto end = std::chrono::high_resolution_clock::now(); std::chrono::duration<double> diff = end-start; std::cout << diff.count() << " seconds. x,y = " << x << "," << y << std::endl; } // Block 2: two operations in loop body { int64_t x = 0, y = 0; auto start = std::chrono::high_resolution_clock::now(); for (long i = 0; i < NUM_ITERATIONS; i++) {x+=17; y-=37;} auto end = std::chrono::high_resolution_clock::now(); std::chrono::duration<double> diff = end-start; std::cout << diff.count() << " seconds. x,y = " << x << "," << y << std::endl; } 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