online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
// 4a.cpp // Multiplicar complejo #include <fstream> #include <iostream> #include <cassert> // assert() using namespace std; typedef struct { int re; int im; } Complejo; void multiplicar(Complejo* ptr1, Complejo* ptr2, Complejo* ptr_producto); int main() { Complejo c1 = {1, 2}, c2 = {3, 5}, producto; char nombre_del_archivo[20] = "producto.bin"; ofstream fout(nombre_del_archivo, ios::binary); // estableciendo coneccion, assert( fout.is_open() ); // verificando multiplicar(&c1, &c2, &producto); fout.write(reinterpret_cast<char*>(&producto), sizeof producto); fout.close(); ifstream fin(nombre_del_archivo, ios::binary); // estableciendo coneccion, assert( fin.is_open() ); // verificando fin.read(reinterpret_cast<char*>(&c1), sizeof c1); cout<<"producto: ("<<c1.re<<") + ("<<c1.im<<")i"<<endl; fin.close(); return 0; } void multiplicar(Complejo* ptr1, Complejo* ptr2, Complejo* ptr_producto) { ptr_producto->re = ptr1->re*ptr2->re - ptr1->im*ptr2->im; ptr_producto->im = ptr1->re*ptr2->im + ptr1->im*ptr2->re; }
ùÿÿÿ

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