online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
#include <iostream> using namespace std; typedef struct { int re; int im; } Complejo; Complejo sumarComplejos(Complejo p1, Complejo p2); void sumar(Complejo * p1, Complejo * p2, Complejo * ps); int main(){ Complejo c1, c2, suma1, suma2; c1.re = 1; c1.im = 2; c2.re = 3; c2.im = 5; // suma1: Parámetros por referencia sumar(&c1, &c2, &suma1); cout << "suma1: ("<<c1.re<<"+"<<c1.im<<"i) + "<<"("<<c2.re<<"+"<<c2.im<<"i) = "; cout <<"("<< suma1.re << "+" << suma1.im << "i)" << endl; // suma2: Parámetros por valor. Función devuelve estructura suma2 = sumarComplejos(c1, c2); cout<<"suma2: ("<<c1.re<<"+"<<c1.im<<"i) + "<<"("<<c2.re<<"+"<<c2.im<<"i) = "; cout<<"("<<suma2.re<<"+"<<suma2.im<<"i)"<<endl; } void sumar(Complejo * p1, Complejo * p2, Complejo * ps) { // el operador "->" se aplica a variables tipo puntero ps->re = p1->re + p2->re; ps->im = p1->im + p2->im; } Complejo sumarComplejos(Complejo p1, Complejo p2){ Complejo respuesta; respuesta.im = p1.im + p2.im; respuesta.re = p1.re + p2.re; return respuesta; }

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