Skip to content
Snippets Groups Projects
Commit 165de427 authored by Alexandros Bokaris's avatar Alexandros Bokaris
Browse files

Ajout d'exercise wims struct_procedure_2

parent ffe4c906
No related branches found
No related tags found
No related merge requests found
#include <iostream>
using namespace std;
struct cpx{
double real;
double img;
};
void sum(cpx x, cpx y, cpx &z)
{
z.real = x.real + y.real + z.real;
z.img = x.img + y.img + z.img;
}
void multiply(cpx x, cpx y, cpx &z)
{
z.real = x.real * y.real - (x.img * y.img);
z.img = x.real * y.img + x.img * y.real;
}
int main()
{
cpx x = { 1, 2 };
cpx y = { 2, 1 };
cpx z = { -1, 3 };
sum(x, y, z);
multiply(z, y, x);
cout << "x = (" << x.real << "," << x.img << ")" << endl;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment