summaryrefslogtreecommitdiff
path: root/sem_2/HLIN202/TP/TP5-6/ex6/exo6.cpp
diff options
context:
space:
mode:
authorGaspard Coulet <gaspard.coulet@mines-ales.org>2021-04-28 23:05:53 +0200
committerGaspard Coulet <gaspard.coulet@mines-ales.org>2021-04-28 23:05:53 +0200
commit9fe033ea88c2f705ec18c232873d056e0c229d72 (patch)
tree0647dc8c51610c7336c88c04de2068ea14b21e17 /sem_2/HLIN202/TP/TP5-6/ex6/exo6.cpp
Initial commit
Diffstat (limited to 'sem_2/HLIN202/TP/TP5-6/ex6/exo6.cpp')
-rw-r--r--sem_2/HLIN202/TP/TP5-6/ex6/exo6.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/sem_2/HLIN202/TP/TP5-6/ex6/exo6.cpp b/sem_2/HLIN202/TP/TP5-6/ex6/exo6.cpp
new file mode 100644
index 0000000..059404d
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP5-6/ex6/exo6.cpp
@@ -0,0 +1,20 @@
+#include<iostream>
+
+void addima (double x, double y, double x2, double y2, double * xrslt, double * yrslt ) {
+ *xrslt = x + x2;
+ *yrslt = y + y2;
+}
+
+void multima (double x, double y, double x2, double y2, double * xrslt, double * yrslt ) {
+ *xrslt = x*x2 + x*y2;
+ *yrslt = y*x2 + y*y2;
+}
+
+int main () {
+ double x=2,y=3,x2=5,y2=1, rsltx, rslty;
+ addima(x,y,x2,y2,&rsltx,&rslty);
+ std::cout<<"(2+3i) +(5+i) = "<< rsltx <<" + " << rslty << "i"<<std::endl;
+ multima(x,y,x2,y2,&rsltx,&rslty);
+ std::cout<<"(2+3i)*(5+i) = "<< rsltx <<" + " << rslty << "i"<<std::endl;
+ return 0;
+}