online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
#include <iostream> #include <thread> using namespace std; void Procedura1(); void Procedura2(); int somma1 = 0; int somma2 = 0; int main(void) { // Includiamo la libreria thread per usufuire della programmazione concorrente. // Le procedure si avvieranno immediatamente. thread P1(Procedura1); thread P2(Procedura2); cout << "Il thread 1 ha ID = " << P1.get_id() << endl; cout << "Il thread 2 ha ID = " << P2.get_id() << endl << endl; P1.join(); P2.join(); cout << "Lavoro dei thread terminato." << endl << endl; int sommaComplessiva = somma1 + somma2; cout << "Il risultato della somma e' pari a " << sommaComplessiva << endl; getchar(); getchar(); return 0; } void Procedura1() { for (int i = 0; i < 200; i++) { somma1 += i; } } void Procedura2() { for (int i = 0; i < 300; i++) { somma2 += i; } }

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