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

Erreur

parent 5c2856b1
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 = { 0, 4 };
cpx y = { 2, 3 };
cpx z = { 1, -2 };
sum(x, y, z);
multiply(z, y, x);
cout << "x = (" << x.real << "," << x.img << ")" << endl;
}
\ No newline at end of file
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