summaryrefslogtreecommitdiff
path: root/sem_2/HLIN202/TP
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
Initial commit
Diffstat (limited to 'sem_2/HLIN202/TP')
-rw-r--r--sem_2/HLIN202/TP/TP1/autres/firstprogbin0 -> 9140 bytes
-rw-r--r--sem_2/HLIN202/TP/TP1/autres/firstprog.cpp7
-rw-r--r--sem_2/HLIN202/TP/TP1/autres/secondprogbin0 -> 9141 bytes
-rw-r--r--sem_2/HLIN202/TP/TP1/autres/secondprog.cpp12
-rw-r--r--sem_2/HLIN202/TP/TP1/ex56/exo56bin0 -> 9354 bytes
-rw-r--r--sem_2/HLIN202/TP/TP1/ex56/exo56.cpp12
-rw-r--r--sem_2/HLIN202/TP/TP1/ex7/exo7convbin0 -> 13448 bytes
-rw-r--r--sem_2/HLIN202/TP/TP1/ex7/exo7conv.cpp22
-rw-r--r--sem_2/HLIN202/TP/TP1/nbparfait/parfaitbin0 -> 9295 bytes
-rw-r--r--sem_2/HLIN202/TP/TP1/nbparfait/parfait.cpp21
-rw-r--r--sem_2/HLIN202/TP/TP11-12/exo 8.txt110
-rw-r--r--sem_2/HLIN202/TP/TP11-12/exo10bin0 -> 13656 bytes
-rw-r--r--sem_2/HLIN202/TP/TP11-12/exo10.cpp66
-rw-r--r--sem_2/HLIN202/TP/TP11-12/exo11bin0 -> 13683 bytes
-rw-r--r--sem_2/HLIN202/TP/TP11-12/exo11.cpp74
-rw-r--r--sem_2/HLIN202/TP/TP11-12/exo5bin0 -> 13589 bytes
-rw-r--r--sem_2/HLIN202/TP/TP11-12/exo5.cpp49
-rw-r--r--sem_2/HLIN202/TP/TP11-12/exo6bin0 -> 14155 bytes
-rw-r--r--sem_2/HLIN202/TP/TP11-12/exo6.cpp98
-rw-r--r--sem_2/HLIN202/TP/TP2/ex10/exo10-1bin0 -> 9293 bytes
-rw-r--r--sem_2/HLIN202/TP/TP2/ex10/exo10-2bin0 -> 9350 bytes
-rw-r--r--sem_2/HLIN202/TP/TP2/ex10/exo10-2.cpp17
-rw-r--r--sem_2/HLIN202/TP/TP2/ex11/exo11bin0 -> 9293 bytes
-rw-r--r--sem_2/HLIN202/TP/TP2/ex11/exo11.cpp15
-rw-r--r--sem_2/HLIN202/TP/TP2/ex7/exo7bin0 -> 9294 bytes
-rw-r--r--sem_2/HLIN202/TP/TP2/ex7/exo7.cpp27
-rw-r--r--sem_2/HLIN202/TP/TP2/ex8/exo8bin0 -> 9297 bytes
-rw-r--r--sem_2/HLIN202/TP/TP2/ex8/exo8.cpp13
-rw-r--r--sem_2/HLIN202/TP/TP2/ex9/exo91bin0 -> 9293 bytes
-rw-r--r--sem_2/HLIN202/TP/TP2/ex9/exo91.cpp14
-rw-r--r--sem_2/HLIN202/TP/TP2/ex9/exo92bin0 -> 9293 bytes
-rw-r--r--sem_2/HLIN202/TP/TP2/ex9/exo92.cpp14
-rw-r--r--sem_2/HLIN202/TP/TP3-4/bonus/bonus.cpp33
-rw-r--r--sem_2/HLIN202/TP/TP3-4/bonus/progbin0 -> 9263 bytes
-rw-r--r--sem_2/HLIN202/TP/TP3-4/ex11/exo11bin0 -> 9336 bytes
-rw-r--r--sem_2/HLIN202/TP/TP3-4/ex11/exo11.cpp21
-rw-r--r--sem_2/HLIN202/TP/TP3-4/ex12/exo12bin0 -> 9342 bytes
-rw-r--r--sem_2/HLIN202/TP/TP3-4/ex12/exo12.cpp23
-rw-r--r--sem_2/HLIN202/TP/TP3-4/ex13/exo13bin0 -> 13775 bytes
-rw-r--r--sem_2/HLIN202/TP/TP3-4/ex13/exo13.cpp137
-rw-r--r--sem_2/HLIN202/TP/TP3-4/ex6/exo6bin0 -> 13586 bytes
-rw-r--r--sem_2/HLIN202/TP/TP3-4/ex6/exo6.cpp39
-rw-r--r--sem_2/HLIN202/TP/TP3-4/ex7/exo7bin0 -> 9285 bytes
-rw-r--r--sem_2/HLIN202/TP/TP3-4/ex7/exo7.cpp34
-rw-r--r--sem_2/HLIN202/TP/TP3-4/ex8/exo8bin0 -> 9388 bytes
-rw-r--r--sem_2/HLIN202/TP/TP3-4/ex8/exo8.cpp25
-rw-r--r--sem_2/HLIN202/TP/TP3-4/ex9/exo9bin0 -> 9276 bytes
-rw-r--r--sem_2/HLIN202/TP/TP3-4/ex9/exo9.cpp29
-rw-r--r--sem_2/HLIN202/TP/TP5-6/ex11/exo11bin0 -> 13514 bytes
-rw-r--r--sem_2/HLIN202/TP/TP5-6/ex11/exo11.cpp29
-rw-r--r--sem_2/HLIN202/TP/TP5-6/ex12/exo12bin0 -> 9386 bytes
-rw-r--r--sem_2/HLIN202/TP/TP5-6/ex12/exo12.cpp23
-rw-r--r--sem_2/HLIN202/TP/TP5-6/ex13/ex13.cpp20
-rw-r--r--sem_2/HLIN202/TP/TP5-6/ex13/exo13bin0 -> 13499 bytes
-rw-r--r--sem_2/HLIN202/TP/TP5-6/ex5/exo5bin0 -> 9237 bytes
-rw-r--r--sem_2/HLIN202/TP/TP5-6/ex5/exo5.cpp14
-rw-r--r--sem_2/HLIN202/TP/TP5-6/ex6/exo6bin0 -> 9288 bytes
-rw-r--r--sem_2/HLIN202/TP/TP5-6/ex6/exo6.cpp20
-rw-r--r--sem_2/HLIN202/TP/TP5-6/ex7/exo7bin0 -> 13775 bytes
-rw-r--r--sem_2/HLIN202/TP/TP5-6/ex7/exo7.cpp14
-rw-r--r--sem_2/HLIN202/TP/TP5-6/ex7/exo7intbin0 -> 9195 bytes
-rw-r--r--sem_2/HLIN202/TP/TP5-6/ex7/exo7int.cpp14
-rw-r--r--sem_2/HLIN202/TP/TP7-8/ex10/eo10bin0 -> 13586 bytes
-rw-r--r--sem_2/HLIN202/TP/TP7-8/ex10/exo10.cpp118
-rw-r--r--sem_2/HLIN202/TP/TP7-8/ex6/exo6bin0 -> 9343 bytes
-rw-r--r--sem_2/HLIN202/TP/TP7-8/ex6/exo6.cpp16
-rw-r--r--sem_2/HLIN202/TP/TP7-8/ex7/exo7bin0 -> 13482 bytes
-rw-r--r--sem_2/HLIN202/TP/TP7-8/ex7/exo7.cpp22
-rw-r--r--sem_2/HLIN202/TP/TP7-8/ex8/exo8bin0 -> 13449 bytes
-rw-r--r--sem_2/HLIN202/TP/TP7-8/ex8/exo8.cpp27
-rw-r--r--sem_2/HLIN202/TP/TP7-8/ex9/exo9bin0 -> 9237 bytes
-rw-r--r--sem_2/HLIN202/TP/TP7-8/ex9/exo9.cpp41
-rw-r--r--sem_2/HLIN202/TP/TP7-8/pendu/pendubin0 -> 13755 bytes
-rw-r--r--sem_2/HLIN202/TP/TP7-8/pendu/pendu.cpp75
-rw-r--r--sem_2/HLIN202/TP/TP9-10/exobin0 -> 13743 bytes
-rw-r--r--sem_2/HLIN202/TP/TP9-10/exo14/exo14bin0 -> 13443 bytes
-rw-r--r--sem_2/HLIN202/TP/TP9-10/exo14/exo14.cpp40
-rw-r--r--sem_2/HLIN202/TP/TP9-10/exo6.cpp140
-rw-r--r--sem_2/HLIN202/TP/TP9-10/exopart2bin0 -> 13582 bytes
-rw-r--r--sem_2/HLIN202/TP/TP9-10/exopart2.cpp51
80 files changed, 1576 insertions, 0 deletions
diff --git a/sem_2/HLIN202/TP/TP1/autres/firstprog b/sem_2/HLIN202/TP/TP1/autres/firstprog
new file mode 100644
index 0000000..4e0a5f5
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP1/autres/firstprog
Binary files differ
diff --git a/sem_2/HLIN202/TP/TP1/autres/firstprog.cpp b/sem_2/HLIN202/TP/TP1/autres/firstprog.cpp
new file mode 100644
index 0000000..5440e7b
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP1/autres/firstprog.cpp
@@ -0,0 +1,7 @@
+#include <iostream>
+
+int main(){
+ std::cout<<"Félicitation, vous avez réussi à compiler et exécuter un programme C++"<<std::endl;
+
+ return 0;
+}
diff --git a/sem_2/HLIN202/TP/TP1/autres/secondprog b/sem_2/HLIN202/TP/TP1/autres/secondprog
new file mode 100644
index 0000000..c3aeebf
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP1/autres/secondprog
Binary files differ
diff --git a/sem_2/HLIN202/TP/TP1/autres/secondprog.cpp b/sem_2/HLIN202/TP/TP1/autres/secondprog.cpp
new file mode 100644
index 0000000..1980255
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP1/autres/secondprog.cpp
@@ -0,0 +1,12 @@
+#include <iostream>
+
+int main(){
+
+ int a,b;
+ a=5;
+ b=8;
+
+ std::cout<<"Félicitation, vous avez réussi à corriger un programme C++"<<std::endl;
+
+ return 0;
+}
diff --git a/sem_2/HLIN202/TP/TP1/ex56/exo56 b/sem_2/HLIN202/TP/TP1/ex56/exo56
new file mode 100644
index 0000000..572237e
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP1/ex56/exo56
Binary files differ
diff --git a/sem_2/HLIN202/TP/TP1/ex56/exo56.cpp b/sem_2/HLIN202/TP/TP1/ex56/exo56.cpp
new file mode 100644
index 0000000..6aabf90
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP1/ex56/exo56.cpp
@@ -0,0 +1,12 @@
+#include <iostream>
+
+int main(){
+ int a, b;
+ std::cout<< " Entrez a puis b" << std::endl;
+ std::cin>>a >> b;
+ std::cout<<"a*b = "<< a*b <<std::endl;
+ std::cout<<"a+b = " << a + b << std::endl;
+ std::cout<<"adresse de a : " << &a << " a vaut : " <<a<< "\nadresse de b : " << &b << " b vaut : " <<b << std::endl;
+
+ return 0;
+}
diff --git a/sem_2/HLIN202/TP/TP1/ex7/exo7conv b/sem_2/HLIN202/TP/TP1/ex7/exo7conv
new file mode 100644
index 0000000..fe731d5
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP1/ex7/exo7conv
Binary files differ
diff --git a/sem_2/HLIN202/TP/TP1/ex7/exo7conv.cpp b/sem_2/HLIN202/TP/TP1/ex7/exo7conv.cpp
new file mode 100644
index 0000000..3519b24
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP1/ex7/exo7conv.cpp
@@ -0,0 +1,22 @@
+#include <iostream>
+
+int main(){
+ float a,c;
+ int b=1;
+ std::cout<< " Entrez une temperature en fahrenheit ou en celcius" << std::endl;
+ std::cin>>a;
+ std::cout<<"Est ce en fahrenheit (1) ou en celcius(2)?"<<std::endl;
+ std::cin >> b;
+ if ( b == 1) {
+ c = ( a - 32 )* (5.0/9.0);
+ std::cout<<a << " Fahrenheit vaut " << c << " Celcius"<<std::endl;
+ }
+ else if ( b == 2 ) {
+ c = 9.0/5.0 * a + 32;
+ std::cout<<a<< " Celcius vaut " << c << " Farhenheit " << std::endl;
+ }
+ else {
+ std::cout<< " Unite incorrecte"<<std::endl;
+ }
+ return 0;
+}
diff --git a/sem_2/HLIN202/TP/TP1/nbparfait/parfait b/sem_2/HLIN202/TP/TP1/nbparfait/parfait
new file mode 100644
index 0000000..2369d66
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP1/nbparfait/parfait
Binary files differ
diff --git a/sem_2/HLIN202/TP/TP1/nbparfait/parfait.cpp b/sem_2/HLIN202/TP/TP1/nbparfait/parfait.cpp
new file mode 100644
index 0000000..6992c95
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP1/nbparfait/parfait.cpp
@@ -0,0 +1,21 @@
+#include <iostream>
+#include <math.h>
+
+int main(){
+ int n, som;
+ std::cout<<" Ce programme calcule les nombre parfaits inferieurs ou egaux a n, entrez n :"<<std::endl;
+ std:: cin >> n;
+ std::cout << " Les nombres parfaits inferieur ou egaux a " << n << " sont : " <<std::endl;
+ for ( int i = 4; i <= n; i ++) {
+ som = 1;
+ for ( int j=2; j <= i/2+1 ; j ++ ) {
+ if ( i % j== 0 ) {
+ som += j;
+ }
+ }
+ if ( som == i ) {
+ std::cout << som << std::endl;
+ }
+ }
+ return 0;
+}
diff --git a/sem_2/HLIN202/TP/TP11-12/exo 8.txt b/sem_2/HLIN202/TP/TP11-12/exo 8.txt
new file mode 100644
index 0000000..3284acd
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP11-12/exo 8.txt
@@ -0,0 +1,110 @@
+struct polynome {
+int degree;
+double *coefs;
+};
+
+1) polynome cree (){
+ polynome ret;
+ std::cout<<" Entrez le degree du polynome " << std::endl;
+ std::cin>> ret.degree;
+ ret.coefs = new double[ret.degree];
+ return ret;
+}
+2) void init ( polynome * poly ) {
+ for ( int i= 0; i < poly->degree; i ++ ) {
+ std::cout<<" Entrez le coefficient pour x^" << i <<std::endl;
+ std::cin >> poly->coefs[i];
+ std::cout<<std::endl;
+ }
+}
+
+3) void affiche ( polynome poly ) {
+ for ( int i =0; i <poly.degree; i ++ ) {
+ std::cout<<poly.coef[i] << "* X^"<<i<<" "<<i == poly.degree-1 ? " " : " + ";
+ }
+ std::cout<<std::endl;
+}
+
+4 ) polynome derive ( polynome poly ) {
+ polynome derivee;
+ derivee.degree = poly.degree - 1;
+ derivee.coefs = new double[direvee.degree];
+ for (int i = 0; i < derivee.degree; i ++ ) {
+ derivee.coefs[i]= poly.coefs[i+1]* (i + 1);
+ }
+ return derivee;
+}
+
+5 ) polynome primitive ( polynome poly ) {
+ polynome primitive;
+ primitive.degree = poly.degree + 1;
+ primitive.coefs = new double[primitive.degree];
+ primitive.coefs[0]= 0;
+ for (int i = 1; i < primitive.degree; i ++ ) {
+ primitive.coefs[i]= poly.coefs[i-1]* (1/(double)(i + 1));
+ }
+ return primitive;
+}
+
+6) double evalue ( polynome poly, double x) {
+ double ret;
+ for ( int i = 0; i < poly.degree; i ++ ) {
+ ret += ret.coefs[i] * pow ( x, i);
+}
+return ret;
+}
+
+EXERCICE 9 :
+
+1 ) pile init () {
+ pile pilvid;
+ pilvid.cardinal=0;
+ pilvid.suivant=NULL;
+}
+2 ) int cardinalpile ( pile pil ) {
+ return pil.cardinal;
+}
+3 ) bool estvide ( pile pil ) {
+ return pil.cardinal == 0;
+}
+4 ) void empiler ( pile *pil, int n) {
+ pil->cardinal ++;
+ cellule * ptr = new cellule;
+ ptr->contenu = n;
+ ptr->suivant = pil->premier;
+ pil->premier = ptr;
+}
+
+5 ) int depiler (pile * pil) {
+ pil->cardinal --;
+int ret = pil->premier->contenu;
+cellule * ptr = pil->premier->suivant;
+delete pil->premier;
+pil->premier = ptr;
+return ret;
+}
+
+6 )
+void libere ( pile * pil) {
+cellule*cell= pil->premier;
+while ( cell->suivant != NULL) {
+ delete cell;
+ cell = cell->suivant;
+}
+delete[] cell;
+delete[] pil;
+}
+
+7 ) void affichepile ( pile pil ) {
+cellule *cell = pil.premier;
+std::cout<<cell->contenu<< " ";
+while ( cell->suivant != NULL ) {
+cell= cell->suivant;
+std::cout<<cell->contenu << " ";
+}
+cell= cell->suivant;
+std::cout<<cell->contenu << " ";
+}
+
+
+
diff --git a/sem_2/HLIN202/TP/TP11-12/exo10 b/sem_2/HLIN202/TP/TP11-12/exo10
new file mode 100644
index 0000000..b22cbfc
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP11-12/exo10
Binary files differ
diff --git a/sem_2/HLIN202/TP/TP11-12/exo10.cpp b/sem_2/HLIN202/TP/TP11-12/exo10.cpp
new file mode 100644
index 0000000..f53abed
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP11-12/exo10.cpp
@@ -0,0 +1,66 @@
+#include<iostream>
+#include<cmath>
+struct vecteur {
+ int dimension;
+ char nom;
+ double *coords;
+};
+
+vecteur* init ( int taille, char nom) {
+ vecteur * ret = new vecteur;
+ ret->dimension= taille;
+ ret->coords = new double[taille];
+ ret->nom=nom;
+ for ( int i =0; i < taille; i ++) {
+ ret->coords[i]=0;
+ }
+ return ret;
+}
+
+vecteur * oppose ( vecteur * vect) {
+ vecteur * ret = init(vect->dimension, vect->nom);
+ for ( int i =0; i < vect->dimension; i ++) {
+ ret->coords[i]= -vect->coords[i];
+ }
+ return ret;
+}
+
+vecteur * somme ( vecteur * vect1, vecteur * vect2) {
+ if ( vect1->dimension == vect2->dimension) {
+ char nom = 's';
+ vecteur * ret=init ( vect1->dimension, nom);
+ for ( int i =0; i < ret->dimension; i ++) {
+ ret->coords[i]= vect1->coords[i]+ vect2->coords[i];
+}
+return ret;
+}
+return 0;
+}
+
+double scalaire ( vecteur * u, vecteur * v ) {
+ if ( u->dimension != v->dimension) {
+ std::cout<< " erreur " << std::endl;
+ return 0; }
+ double ret=0;
+ for ( int i = 0; i < u->dimension; i ++) {
+ ret += u->coords[i]*v->coords[i];
+ }
+ return ret;
+}
+
+double norme ( vecteur * u ) {
+ return sqrt(scalaire ( u,u));
+}
+
+int main () {
+ vecteur * u = init(2, *"u");
+ vecteur * v = init(2, *"v");
+ v->coords[0]= 0;
+ v->coords[1]= 1;
+ u->coords[0]= 45;
+ u->coords[1]= 1;
+ std::cout<< scalaire(u,v)<<std::endl;
+ std::cout<< " Norme de u : " << norme(u)<<std::endl;
+
+ return 0;
+}
diff --git a/sem_2/HLIN202/TP/TP11-12/exo11 b/sem_2/HLIN202/TP/TP11-12/exo11
new file mode 100644
index 0000000..5dd2658
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP11-12/exo11
Binary files differ
diff --git a/sem_2/HLIN202/TP/TP11-12/exo11.cpp b/sem_2/HLIN202/TP/TP11-12/exo11.cpp
new file mode 100644
index 0000000..d99d75a
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP11-12/exo11.cpp
@@ -0,0 +1,74 @@
+#include <iostream>
+
+struct cellule {
+ int contenu;
+ cellule *suivant;
+};
+struct file {
+ cellule *premier;
+ cellule *dernier;
+};
+
+file* init () {
+ file * ret = new file;
+ ret->premier=NULL;
+ ret->dernier=NULL;
+ return ret;
+}
+int cardinal ( file *w) {
+ int ret = 1;
+ if (w->premier == NULL ) return 0;
+ cellule * tmp = w->premier;
+ while ( tmp->suivant != NULL) {
+ tmp = tmp->suivant;
+ ret ++;
+ }
+ return ret;
+}
+bool estvide(file *w){
+ return cardinal(w)==0;
+}
+
+void ajouter(file *w, int valeur){
+ cellule * tmp = new cellule;
+ tmp->contenu = valeur;
+ tmp->suivant = w->premier;
+ w->premier = tmp;
+}
+
+int retire( file *w) {
+ int value;
+ cellule * ptr = w->premier;
+ while ( ptr->suivant->suivant != NULL) {
+ ptr = ptr->suivant;
+ }
+ value = ptr->suivant->contenu;
+ delete ptr->suivant;
+ ptr->suivant = NULL;
+ w->dernier = ptr;
+ return value;
+}
+
+void retirefile ( file * w) {
+ while ( w->premier != NULL) {
+ retire(w);
+ }
+ delete w;
+}
+
+void affichefile ( file * w ) {
+ cellule * ptr = w->premier;
+ std::cout << "\" ";
+ while ( ptr != NULL) {
+ std::cout<< ptr->contenu << " ";
+ ptr= ptr->suivant;
+ }
+ std::cout << " \""<< std::endl;
+}
+
+int main () {
+ file * ptrfile = init();
+
+ std::cout << " Taille de la file : " << cardinal(ptrfile)<< std::endl;
+ return 0;
+}
diff --git a/sem_2/HLIN202/TP/TP11-12/exo5 b/sem_2/HLIN202/TP/TP11-12/exo5
new file mode 100644
index 0000000..6287485
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP11-12/exo5
Binary files differ
diff --git a/sem_2/HLIN202/TP/TP11-12/exo5.cpp b/sem_2/HLIN202/TP/TP11-12/exo5.cpp
new file mode 100644
index 0000000..24b70b7
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP11-12/exo5.cpp
@@ -0,0 +1,49 @@
+#include<iostream>
+
+struct CD {
+ int pistes;
+ int duree[100];
+};
+
+CD cree (){
+ CD disque;
+ return disque;
+}
+
+void init ( CD *disque) {
+ std::cout<<"Entrez le nombre de pistes"<<std::endl;
+ std::cin>>disque->pistes;
+ for (int i = 0; i < disque->pistes; i++) {
+ std::cout<<"Entrez la duree (en secondes) de la piste numero : "<< i+1<< std::endl;
+ std::cin>> disque->duree[i];
+ }
+}
+void afficheCD ( CD * disque){
+ std::cout<< " Le CD est compose de " << disque->pistes << " pistes."<<std::endl;
+ std::cout<<"Numero de piste | Duree"<<std::endl;
+ for ( int i = 0 ; i < disque->pistes; i ++) {
+ std::cout<< " "<< i + 1 << " "<<disque->duree[i]<<std::endl;
+ }
+}
+int dureetotale(CD disque){
+ int ret=0;
+ for (int i =0; i < disque.pistes; i ++) {
+ ret+=disque.duree[i];
+ }
+ return ret;
+}
+int nbPistesSup ( CD disque, int duree) {
+ int ret = 0;
+ for (int i=0; i < disque.pistes; i ++){
+ ret+= disque.duree[i]>duree ? 1 : 0;
+ }
+ return ret;
+}
+
+int main () {
+ CD disque;
+ init(&disque);
+ std::cout<<"Duree totale : "<< dureetotale(disque)<<std::endl;
+ afficheCD(&disque);
+ return 0;
+}
diff --git a/sem_2/HLIN202/TP/TP11-12/exo6 b/sem_2/HLIN202/TP/TP11-12/exo6
new file mode 100644
index 0000000..c24233d
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP11-12/exo6
Binary files differ
diff --git a/sem_2/HLIN202/TP/TP11-12/exo6.cpp b/sem_2/HLIN202/TP/TP11-12/exo6.cpp
new file mode 100644
index 0000000..55b5d4d
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP11-12/exo6.cpp
@@ -0,0 +1,98 @@
+#include<iostream>
+#include<cmath>
+
+
+struct s_point {
+ char nom;
+ int x,y;
+};
+
+struct lignepolygonale {
+ int nombre;
+ s_point *points;
+};
+
+double distance (s_point, s_point);
+void affiche (s_point);
+
+double longueur ( lignepolygonale lp) {
+ double ret=0;
+ for ( int i = 0; i < lp.nombre-1; i ++) {
+ ret += distance (lp.points[i], lp.points[i+1]);
+ }
+ return ret;
+}
+lignepolygonale saisieLP () {
+ lignepolygonale ret;
+ std::cout<<"Nombre de points de la LP :";
+ std::cin>>ret.nombre;
+ std::cout<<std::endl;
+ ret.points=new s_point[ret.nombre];
+ for ( int i =0; i < ret.nombre; i ++) {
+ std::cout<< " Entrez le nom du point numero "<<i+1<<" ";
+ std::cin >> ret.points[i].nom;
+ std::cout << " Entrez les coords du point " << ret.points[i].nom << std::endl<<"x : ";
+ std::cin >> ret.points[i].x;
+ std::cout<<" y : ";
+ std::cin>>ret.points[i].y;
+ std::cout<<std::endl;
+ }
+ return ret;
+}
+lignepolygonale carre ( int n, s_point A) {
+ lignepolygonale ret;
+ ret.nombre=5;
+ ret.points=new s_point[ret.nombre];
+ ret.points[0]=A;
+ ret.points[1].x=A.x+n;
+ ret.points[1].y=A.y;
+ ret.points[2].x=A.x+n;
+ ret.points[2].y=A.y+n;
+ ret.points[3].x=A.x;
+ ret.points[3].y=A.y+n;
+ ret.points[4]=A;
+ return ret;
+}
+void afficheLP ( lignepolygonale lp){
+ for (int i = 0; i< lp.nombre; i ++){
+ affiche(lp.points[i]);
+ }
+}
+double distance (s_point a, s_point b){
+ return sqrt(pow(b.x-a.x,2)+pow(b.y-a.y,2));
+}
+
+s_point saisie (){
+ s_point point;
+ std::cout<<"Saisir le nom du point ( une lettre capitale) "<<std::endl;
+ std::cin>>point.nom;
+ std::cout<<std::endl<<"Saisir la coordonnee en x ";
+ std::cin >>point.x;
+ std::cout << std::endl << "Saisir la coordonnee en y ";
+ std::cin >> point.y;
+ std::cout << std::endl;
+ if ( (int) point.nom > 90 || (int)point.nom < 65){
+ std::cout<<" Saisie incorrecte"<<std::endl;
+ point = saisie();}
+ return point;
+}
+void affiche (s_point point){
+ std::cout<<"point"<<point.nom<<" de coordonees " << point.x << point.y << std::endl;
+}
+void maz ( s_point * point) {
+ point->nom = (char)0;
+ point->x=0;
+ point->y=0;
+}
+s_point sym ( s_point point) {
+ s_point ret;
+ ret.x= - point.x;
+ ret.y= -point.y;
+ ret.nom = (char)(65+(90-(int)point.nom));
+ return ret;
+}
+int main () {
+ lignepolygonale zbeb;
+ zbeb=saisieLP();
+ return 0;
+}
diff --git a/sem_2/HLIN202/TP/TP2/ex10/exo10-1 b/sem_2/HLIN202/TP/TP2/ex10/exo10-1
new file mode 100644
index 0000000..10b03c3
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP2/ex10/exo10-1
Binary files differ
diff --git a/sem_2/HLIN202/TP/TP2/ex10/exo10-2 b/sem_2/HLIN202/TP/TP2/ex10/exo10-2
new file mode 100644
index 0000000..227f81c
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP2/ex10/exo10-2
Binary files differ
diff --git a/sem_2/HLIN202/TP/TP2/ex10/exo10-2.cpp b/sem_2/HLIN202/TP/TP2/ex10/exo10-2.cpp
new file mode 100644
index 0000000..7f99fd5
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP2/ex10/exo10-2.cpp
@@ -0,0 +1,17 @@
+#include<iostream>
+
+int main () {
+ int a=0, cpt=0, som=0;
+ float moy=0;
+ std::cout<<"Entrez des entiers ( rel ), ce programme donne le nombre d'entier positifs entres avant le premier negatif"<<std::endl;
+ while ( a >=0 ) {
+ std::cin>>a;
+ cpt += a>=0 ? 1:0;
+ moy += a>0 ? a : 0;
+ }
+ moy=moy/cpt;
+ std::cout<<"Vous avez entre "<< cpt<< " positif avant de rentrer un negatif"<<std::endl;
+ std::cout<<"La moyenne des donnes est : " << moy << std::endl;
+ return 0;
+}
+
diff --git a/sem_2/HLIN202/TP/TP2/ex11/exo11 b/sem_2/HLIN202/TP/TP2/ex11/exo11
new file mode 100644
index 0000000..991f7a0
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP2/ex11/exo11
Binary files differ
diff --git a/sem_2/HLIN202/TP/TP2/ex11/exo11.cpp b/sem_2/HLIN202/TP/TP2/ex11/exo11.cpp
new file mode 100644
index 0000000..d4fd4b8
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP2/ex11/exo11.cpp
@@ -0,0 +1,15 @@
+#include<iostream>
+
+int main () {
+ int n, a;
+ float x,y;
+ std::cout<<"Entrez a et n, ce programme calcule la racine carre de a via l'algorithme de Heron D'Alexandrie, avec une precision n "<<std::endl;
+ std::cin >> a >>n;
+ x = a;
+ do {
+ y = x;
+ x = y/2 + a/(2*y);
+ std::cout<<x<<std::endl;
+ } while ( x-y < 1/n);
+ return 0;
+}
diff --git a/sem_2/HLIN202/TP/TP2/ex7/exo7 b/sem_2/HLIN202/TP/TP2/ex7/exo7
new file mode 100644
index 0000000..902f13c
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP2/ex7/exo7
Binary files differ
diff --git a/sem_2/HLIN202/TP/TP2/ex7/exo7.cpp b/sem_2/HLIN202/TP/TP2/ex7/exo7.cpp
new file mode 100644
index 0000000..05c0533
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP2/ex7/exo7.cpp
@@ -0,0 +1,27 @@
+#include <iostream>
+
+int main(){
+ int a,b,c,min,max;
+ std::cout<<"Entrez 3 entiers, ce programme donnera le minimum et le maximum des trois"<<std::endl;
+ std::cin>> a >> b >> c;
+ if ( a >= b && a >= c) {
+ max = a;
+ }
+ else if ( b >= a && b >= c ) {
+ max = b;
+ }
+ else if ( c >= a && c >= b ) {
+ max = c;
+ }
+ if ( a <= b && a <= c ) {
+ min = a;
+ }
+ else if ( b <= a && b <=c ) {
+ min = b;
+ }
+ else if ( c <= a && c <= b ) {
+ min = c;
+ }
+ std::cout << "Le max est : " << max << " Le min est : " << min << std::endl;
+ return 0;
+}
diff --git a/sem_2/HLIN202/TP/TP2/ex8/exo8 b/sem_2/HLIN202/TP/TP2/ex8/exo8
new file mode 100644
index 0000000..3f2470c
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP2/ex8/exo8
Binary files differ
diff --git a/sem_2/HLIN202/TP/TP2/ex8/exo8.cpp b/sem_2/HLIN202/TP/TP2/ex8/exo8.cpp
new file mode 100644
index 0000000..7caa991
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP2/ex8/exo8.cpp
@@ -0,0 +1,13 @@
+#include <iostream>
+
+int main () {
+ int x,n,reslt;
+ std::cout<<" Entrez x puis n, ce programme calcule la valeur de x exposant n" << std::endl;
+ std::cin>> x >> n;
+ reslt = 1;
+ for ( int i=0; i < n; i ++) {
+ reslt = x * reslt;
+ }
+ std::cout << x << " exposant " << n << " vaut : " << reslt <<std::endl;
+ return 0;
+}
diff --git a/sem_2/HLIN202/TP/TP2/ex9/exo91 b/sem_2/HLIN202/TP/TP2/ex9/exo91
new file mode 100644
index 0000000..8960964
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP2/ex9/exo91
Binary files differ
diff --git a/sem_2/HLIN202/TP/TP2/ex9/exo91.cpp b/sem_2/HLIN202/TP/TP2/ex9/exo91.cpp
new file mode 100644
index 0000000..da7ea97
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP2/ex9/exo91.cpp
@@ -0,0 +1,14 @@
+#include<iostream>
+
+int main () {
+ int n;
+ float reslt;
+ std::cout << " Entrez un enter n, ce programme calcule la somme des inverses de 1 a n" << std::endl;
+ std::cin >> n;
+ for (int i=1; i <= n; i ++) {
+ reslt += 1.0/i;
+ }
+ std::cout<<"Le resultat est : "<< reslt <<std::endl;
+ return 0;
+ }
+
diff --git a/sem_2/HLIN202/TP/TP2/ex9/exo92 b/sem_2/HLIN202/TP/TP2/ex9/exo92
new file mode 100644
index 0000000..b21cc8d
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP2/ex9/exo92
Binary files differ
diff --git a/sem_2/HLIN202/TP/TP2/ex9/exo92.cpp b/sem_2/HLIN202/TP/TP2/ex9/exo92.cpp
new file mode 100644
index 0000000..9787e2f
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP2/ex9/exo92.cpp
@@ -0,0 +1,14 @@
+#include<iostream>
+
+int main () {
+ int n,deb;
+ float reslt;
+ std::cout << " Entrez un enter n et i, ce programme calcule la somme des inverses de 1/i a 1/n" <<std::endl;
+ std::cin >> n >> deb;
+ for (int i=deb; i <= n; i ++) {
+ reslt += 1.0/i;
+ }
+ std::cout<<"Le resultat est : "<< reslt <<std::endl;
+ return 0;
+ }
+
diff --git a/sem_2/HLIN202/TP/TP3-4/bonus/bonus.cpp b/sem_2/HLIN202/TP/TP3-4/bonus/bonus.cpp
new file mode 100644
index 0000000..8a8b6a3
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP3-4/bonus/bonus.cpp
@@ -0,0 +1,33 @@
+#include<iostream>
+#include<math.h>
+
+void triangle (int k);
+int combo ( int, int);
+
+int main () {
+ triangle ( 20 );
+ return 0;
+
+}
+
+void triangle ( int k ) {
+ int n,p,ligne;
+ n = 0;
+ p = 0;
+ ligne = 1;
+ while ( p <= k) {
+ while ( n <=p ) {
+ for ( int i=0; i < ligne; i ++) {
+ std::cout<< combo ( n, i ) << " ";
+ }
+ std::cout<<std::endl;
+ n ++;
+ ligne ++;
+ }
+ p ++;
+}
+}
+
+int combo ( int n, int p) {
+ return (n == p || p == 0) ? 1 : combo(n-1,p) + combo ( n-1,p-1);
+}
diff --git a/sem_2/HLIN202/TP/TP3-4/bonus/prog b/sem_2/HLIN202/TP/TP3-4/bonus/prog
new file mode 100644
index 0000000..da45351
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP3-4/bonus/prog
Binary files differ
diff --git a/sem_2/HLIN202/TP/TP3-4/ex11/exo11 b/sem_2/HLIN202/TP/TP3-4/ex11/exo11
new file mode 100644
index 0000000..50cfbdb
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP3-4/ex11/exo11
Binary files differ
diff --git a/sem_2/HLIN202/TP/TP3-4/ex11/exo11.cpp b/sem_2/HLIN202/TP/TP3-4/ex11/exo11.cpp
new file mode 100644
index 0000000..f777ac5
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP3-4/ex11/exo11.cpp
@@ -0,0 +1,21 @@
+#include<iostream>
+
+double piquart ( double incert) {
+ int cpt=3;
+ bool pair = false;
+ double pisurquatre=1;
+ while ( 1/(double)cpt> incert) {
+ pisurquatre = pair ? pisurquatre+1 /(double)cpt : pisurquatre-1/(double)cpt;
+ cpt+=2;
+ pair = pair ? false : true;
+ }
+ return pisurquatre;
+}
+
+int main () {
+ double precision;
+ std::cout<< " Entrez la precision ( < 1 ) a laquelle vous voulez apprecier la valeur de pi" << std::endl;
+ std::cin>>precision;
+ std::cout<< 4*piquart(precision)<<std::endl;
+ return 0;
+}
diff --git a/sem_2/HLIN202/TP/TP3-4/ex12/exo12 b/sem_2/HLIN202/TP/TP3-4/ex12/exo12
new file mode 100644
index 0000000..faeaf3a
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP3-4/ex12/exo12
Binary files differ
diff --git a/sem_2/HLIN202/TP/TP3-4/ex12/exo12.cpp b/sem_2/HLIN202/TP/TP3-4/ex12/exo12.cpp
new file mode 100644
index 0000000..dca387c
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP3-4/ex12/exo12.cpp
@@ -0,0 +1,23 @@
+#include<iostream>
+
+int ackermann (int m, int n) {
+ int rslt=0;
+ if ( m == 0 && n>=0) {
+ rslt=n+1;
+ }
+ else if ( n==0 && m>0) {
+ rslt= ackermann(m-1,1);
+ }
+ else {
+ rslt= ackermann(m-1,ackermann(m,n-1));
+ }
+ return rslt;
+}
+
+int main () {
+ int n,m;
+ std::cout<<" Entrez deux nombre m et n, ce programme calcule la valeur de la fonction d'ackermann pour (m,n)"<<std::endl;
+ std::cin>>m>>n;
+ std::cout<<ackermann(m,n)<<std::endl;
+ return 0;
+}
diff --git a/sem_2/HLIN202/TP/TP3-4/ex13/exo13 b/sem_2/HLIN202/TP/TP3-4/ex13/exo13
new file mode 100644
index 0000000..fb21331
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP3-4/ex13/exo13
Binary files differ
diff --git a/sem_2/HLIN202/TP/TP3-4/ex13/exo13.cpp b/sem_2/HLIN202/TP/TP3-4/ex13/exo13.cpp
new file mode 100644
index 0000000..8a89e71
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP3-4/ex13/exo13.cpp
@@ -0,0 +1,137 @@
+ #include<iostream>
+
+int nbjourmois(int,bool);
+int saisieJour(int,bool);
+int saisieMois();
+int saisieAnnee();
+void affichejour();
+bool estbissextile(int);
+int nbjourmois(int,bool);
+int compteJours(int,int,bool);
+int compteanneebissextile(int);
+void codeJourAnnee(int,int,int);
+
+int main () {
+ int jour, mois, annee;
+ annee = saisieAnnee ();
+ mois= saisieMois ();
+ jour= saisieJour(mois, estbissextile(annee));
+ codeJourAnnee(jour,mois,annee );
+ return 0;
+}
+
+int saisieJour (int mois, bool bissextile) {
+ int enter;
+ std::cout<<"Entrez le jour " << std::endl;
+ std::cin>>enter;
+ if ( enter > nbjourmois(mois, bissextile) || enter < 1) {
+ std::cout<< " Jour incorrect" << std::endl;
+ enter = saisieJour ( mois, bissextile);
+ }
+ return enter;
+}
+
+int saisieMois () {
+ int enter;
+ std::cout<<"Entrez le mois"<<std::endl;
+ std::cin>>enter;
+ if ( enter < 1 || enter > 12 ) {
+ std::cout<<"Mois incorrect"<<std::endl;
+ enter = saisieMois ();
+ }
+ return enter;
+}
+
+int saisieAnnee () {
+ int enter;
+ std::cout<<"Entrez l'annee"<<std::endl;
+ std::cin>>enter;
+ return enter;
+}
+
+void affichejour ( int jour) {
+ switch ( jour ) {
+ case 0 :
+ std::cout<<"Lundi"<<std::endl;
+ break;
+ case 1 :
+ std::cout<<"Mardi"<<std::endl;
+ break;
+ case 2 :
+ std::cout<<"Mercredi"<<std::endl;
+ break;
+ case 3 :
+ std::cout<<"Jeudi"<<std::endl;
+ break;
+ case 4 :
+ std::cout<<"Vendredi"<<std::endl;
+ break;
+ case 5 :
+ std::cout<<"Samedi"<<std::endl;
+ break;
+ case 6 :
+ std::cout<<"Dimanche"<<std::endl;
+ break;
+ }
+}
+
+bool estbissextile ( int n ) {
+ bool ret=false;
+ if ( n % 4 == 0 && n % 100 != 0 ) {
+ ret = true;
+ }
+ else if ( n % 400 == 0 ) {
+ ret = true;
+ }
+ return ret;
+}
+
+int nbjourmois ( int n, bool bissextile) {
+ if ( n == 1 || n == 3 || n == 5 || n == 7 || n == 8 || n == 10 || n ==12 ) {
+ return 31;
+ }
+ else if ( n == 2) {
+ return bissextile ? 29 : 28;
+ }
+ else {
+ return 30;
+ }
+}
+
+int compteJours ( int jour, int mois, bool bissextile) {
+ int jours = 0;
+ jours = jour;
+ for ( int i=1; i < mois; i ++){
+ jours += nbjourmois(i, estbissextile(i));
+ }
+ return jours;
+}
+
+int compteanneebissextile ( int annee) {
+ int cpt=annee;
+ int rslt=0;
+ while ( cpt != 2000) {
+ if ( estbissextile(cpt)) {
+ rslt ++;
+ }
+ annee < 2000 ? cpt ++ : cpt --;
+ }
+ return rslt;
+}
+
+void codeJourAnnee ( int jour, int mois, int annee) {
+ int rslt = 0;
+//premier janvier 2000 : samedi affichejour(5);
+ if ( annee < 2000) {
+ rslt = (2000 - annee)*365 + compteanneebissextile(annee) - compteJours(jour, mois, estbissextile(annee));;
+ }
+ else if (annee > 2000 ) {
+ rslt += estbissextile(annee) ? compteJours(jour, mois, true) : compteJours(jour, mois, false);
+ rslt += (annee-2000)*365 + compteanneebissextile(annee)+1;
+ }
+ else {
+ rslt += compteJours(jour,mois, estbissextile(annee));
+ }
+ std::cout<<"Le "<<jour << "/"<<mois<<"/"<<annee<<" est un ";
+ affichejour((rslt+4)%7);
+}
diff --git a/sem_2/HLIN202/TP/TP3-4/ex6/exo6 b/sem_2/HLIN202/TP/TP3-4/ex6/exo6
new file mode 100644
index 0000000..2db9099
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP3-4/ex6/exo6
Binary files differ
diff --git a/sem_2/HLIN202/TP/TP3-4/ex6/exo6.cpp b/sem_2/HLIN202/TP/TP3-4/ex6/exo6.cpp
new file mode 100644
index 0000000..d7e33c8
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP3-4/ex6/exo6.cpp
@@ -0,0 +1,39 @@
+#include<iostream>
+
+bool estunenote ( float n ) {
+ return n <=20 && n>= 0 ? true : false;
+}
+
+float moyenne ( int n) {
+ int cpt;
+ bool flag;
+ float moy, note;
+ cpt = 1;
+ flag = true;
+ moy = 0;
+ note = 0;
+ while ( flag && cpt <= n ) {
+ std::cout<<"Entrez la note numero " <<cpt<< std::endl;
+ std::cin>>note;
+ moy += note;
+ cpt ++;
+ flag = estunenote(note);
+ }
+ if ( flag ) {
+ moy = moy/ n;
+ }
+ else {
+ std :: cout << " La valeur entree n'est pas une note"<<std::endl;
+ moy=-1;
+ }
+ return moy;
+}
+
+int main () {
+ int nb;
+ std::cout << " Entrez le nombre de notes" << std::endl;
+ std::cin >> nb;
+// nb=moyenne(nb);
+ std::cout << " La moyenne est : " << moyenne(nb)<< std::endl;
+ return 0;
+}
diff --git a/sem_2/HLIN202/TP/TP3-4/ex7/exo7 b/sem_2/HLIN202/TP/TP3-4/ex7/exo7
new file mode 100644
index 0000000..1f9f23c
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP3-4/ex7/exo7
Binary files differ
diff --git a/sem_2/HLIN202/TP/TP3-4/ex7/exo7.cpp b/sem_2/HLIN202/TP/TP3-4/ex7/exo7.cpp
new file mode 100644
index 0000000..b0d86be
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP3-4/ex7/exo7.cpp
@@ -0,0 +1,34 @@
+#include<iostream>
+#include<math.h>
+
+bool nombreeligible ( int n) {
+ int som=0,cpt =1, act=0, puiss=0;
+ act = n;
+ while ( n > 10 ) {
+ n= n/10;
+ cpt ++;
+ }
+ for ( int i=cpt; i >= 0; i--) {
+ puiss = (int) pow(10,i);
+ som += (int)pow((act/puiss)%10,3);
+ }
+ return som==act ? true : false ;
+}
+
+bool tripleteligible ( int a, int b, int c) {
+ int n = a*100 + b*10 + c;
+ return n == pow(a,3) + pow (b,3) + pow(c,3);
+}
+
+void testeentier () {
+ for (int i = 2; i < 1000; i ++) {
+ if(nombreeligible(i)) {
+ std::cout << i << std::endl;
+ }
+ }
+}
+
+int main () {
+ testeentier();
+ return 0;
+}
diff --git a/sem_2/HLIN202/TP/TP3-4/ex8/exo8 b/sem_2/HLIN202/TP/TP3-4/ex8/exo8
new file mode 100644
index 0000000..5fcea62
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP3-4/ex8/exo8
Binary files differ
diff --git a/sem_2/HLIN202/TP/TP3-4/ex8/exo8.cpp b/sem_2/HLIN202/TP/TP3-4/ex8/exo8.cpp
new file mode 100644
index 0000000..81241a7
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP3-4/ex8/exo8.cpp
@@ -0,0 +1,25 @@
+#include<iostream>
+
+bool estpremier ( int n) {
+ int cpt=2;
+ bool trouve= false;
+ while ( !trouve && cpt <= n/2 ) {
+ if ( n % cpt == 0) {
+ trouve = true;
+ }
+ cpt ++;
+ }
+ return !trouve;
+}
+int prochainpremier ( int n) {
+ while ( !estpremier(n)) {
+ n++;
+ }
+ return n;
+}
+int main () {
+ int n=0;
+ std::cin>>n;
+ std::cout << n << " prochain premier " << prochainpremier(n)<<std::endl;
+ return 0;
+}
diff --git a/sem_2/HLIN202/TP/TP3-4/ex9/exo9 b/sem_2/HLIN202/TP/TP3-4/ex9/exo9
new file mode 100644
index 0000000..490551d
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP3-4/ex9/exo9
Binary files differ
diff --git a/sem_2/HLIN202/TP/TP3-4/ex9/exo9.cpp b/sem_2/HLIN202/TP/TP3-4/ex9/exo9.cpp
new file mode 100644
index 0000000..4d038ce
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP3-4/ex9/exo9.cpp
@@ -0,0 +1,29 @@
+#include<iostream>
+
+void arbre ( int base) {
+ if (base%2==1) {
+ int espaces = (base-1)/2;
+ int nb=1;
+ int etage = base / 2 +1;
+ for ( int i=1; i<=etage; i ++) {
+ for ( int j=1; j<=espaces; j ++) {
+ std::cout<<" ";
+ }
+
+ for (int k=1; k<=nb; k ++) {
+ std::cout<<"*";
+ }
+ std::cout<<std::endl;
+ espaces--;
+ nb += 2;
+ }
+ }
+}
+
+int main () {
+ int n=0;
+ std::cout << " Entrez le nombre d'etoiles voulues a la base"<<std::endl;
+ std::cin>>n;
+ arbre(n);
+ return 0;
+}
diff --git a/sem_2/HLIN202/TP/TP5-6/ex11/exo11 b/sem_2/HLIN202/TP/TP5-6/ex11/exo11
new file mode 100644
index 0000000..181c922
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP5-6/ex11/exo11
Binary files differ
diff --git a/sem_2/HLIN202/TP/TP5-6/ex11/exo11.cpp b/sem_2/HLIN202/TP/TP5-6/ex11/exo11.cpp
new file mode 100644
index 0000000..7b88eaa
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP5-6/ex11/exo11.cpp
@@ -0,0 +1,29 @@
+#include<iostream>
+#include<math.h>
+
+int solveurseconddeg ( double a, double b, double c, double * x1, double * x2) {
+ double delta = (b*b)-(4*a*c);
+ if (delta > 0) {
+ *x1 = (-b-sqrt(delta))/(2*a);
+ *x2 = (-b+sqrt(delta))/(2*a);
+ return 2;
+ }
+ else if ( delta == 0 && a!=0) {
+ *x1=-b/(2*a);
+ return 1;
+ }
+ else {
+ return 0;
+ }
+}
+int main () {
+ double a = 1, b=1, c=1;
+ double rslt1, rslt2;
+ std::cout<< " Entrez a, b et c, ce programme calcule les racines du polynome ax^2+bx+c : "<<std::endl;
+ std::cin >> a >> b >> c ;
+ int racines = solveurseconddeg(a,b,c,&rslt1,&rslt2);
+ if ( racines==0) { std::cout<<"Le polynome n'a pas de solution"<<std::endl;}
+ else if (racines == 1) { std::cout<<"Le polynome a une racine : " << rslt1 << std::endl;}
+ else if ( racines == 2) { std::cout << "Le polynome a deux racines : " << rslt1 << " et : " << rslt2<< std::endl;}
+ return 0;
+}
diff --git a/sem_2/HLIN202/TP/TP5-6/ex12/exo12 b/sem_2/HLIN202/TP/TP5-6/ex12/exo12
new file mode 100644
index 0000000..d286648
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP5-6/ex12/exo12
Binary files differ
diff --git a/sem_2/HLIN202/TP/TP5-6/ex12/exo12.cpp b/sem_2/HLIN202/TP/TP5-6/ex12/exo12.cpp
new file mode 100644
index 0000000..903014c
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP5-6/ex12/exo12.cpp
@@ -0,0 +1,23 @@
+#include<iostream>
+
+void OnePgcdStep ( int *u, int *v) {
+ int w,x;
+ w= *v % *u;
+ x= *u % w;
+ *u= w;
+ *v= x;
+}
+
+int pgcd (int a, int b) {
+ while (b!=0) {
+ OnePgcdStep(&a,&b);
+ }
+ return a;
+}
+
+int main () {
+ int a,b;
+ std::cin>> a >> b;
+ std::cout<<"Le PGCD de ("<<a<<","<<b << ") est : "<<pgcd(a,b)<<std::endl;
+ return 0;
+}
diff --git a/sem_2/HLIN202/TP/TP5-6/ex13/ex13.cpp b/sem_2/HLIN202/TP/TP5-6/ex13/ex13.cpp
new file mode 100644
index 0000000..d61c5b0
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP5-6/ex13/ex13.cpp
@@ -0,0 +1,20 @@
+#include<iostream>
+
+int main () {
+ int x;
+ float y;
+ int *ptr;
+ float *ptr2;
+ std::cout<<" Entrez un nombre entier" << std::endl;
+ std::cin>>x;
+ ptr=&x;
+ ptr2 = (float*)ptr;
+
+ std::cout<<"L'entier "<< x << " vaut " << *ptr2 << " en interpretation flottante" << std::endl;
+ std::cout<<" Entrez un nombre flottant" << std::endl;
+ std::cin>>y;
+ ptr2 = &y;
+ ptr = (int*)ptr2;
+ std::cout<<"Le flottant "<< y << " vaut " << *ptr << " en interpretation entiere" << std::endl;
+ return 0;
+}
diff --git a/sem_2/HLIN202/TP/TP5-6/ex13/exo13 b/sem_2/HLIN202/TP/TP5-6/ex13/exo13
new file mode 100644
index 0000000..be66305
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP5-6/ex13/exo13
Binary files differ
diff --git a/sem_2/HLIN202/TP/TP5-6/ex5/exo5 b/sem_2/HLIN202/TP/TP5-6/ex5/exo5
new file mode 100644
index 0000000..739ade0
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP5-6/ex5/exo5
Binary files differ
diff --git a/sem_2/HLIN202/TP/TP5-6/ex5/exo5.cpp b/sem_2/HLIN202/TP/TP5-6/ex5/exo5.cpp
new file mode 100644
index 0000000..ae369d4
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP5-6/ex5/exo5.cpp
@@ -0,0 +1,14 @@
+#include <iostream>
+
+int* max ( int* a, int* b, int* c) {
+ if ( *a>=*b && *a>=*c) return a;
+ if ( *b>=*a && *b>=*c) return b;
+ if ( *c>=*a && *c>=*b) return c;
+ else return 0;
+}
+
+int main () {
+ int x=2, y=4, z=3;
+ std::cout<<"le max est à l'adresse : " << max(&x,&y,&z) << std::endl;
+ return 0;
+}
diff --git a/sem_2/HLIN202/TP/TP5-6/ex6/exo6 b/sem_2/HLIN202/TP/TP5-6/ex6/exo6
new file mode 100644
index 0000000..991cc87
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP5-6/ex6/exo6
Binary files differ
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;
+}
diff --git a/sem_2/HLIN202/TP/TP5-6/ex7/exo7 b/sem_2/HLIN202/TP/TP5-6/ex7/exo7
new file mode 100644
index 0000000..238c136
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP5-6/ex7/exo7
Binary files differ
diff --git a/sem_2/HLIN202/TP/TP5-6/ex7/exo7.cpp b/sem_2/HLIN202/TP/TP5-6/ex7/exo7.cpp
new file mode 100644
index 0000000..f37648c
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP5-6/ex7/exo7.cpp
@@ -0,0 +1,14 @@
+#include<iostream>
+
+int main () {
+ double a;
+ double c;
+ double b;
+ double *adda=&a;
+ double *addb=&b;
+ double *addc=&c;
+ double shift = (addb-adda) *(sizeof(double));
+ std::cout<< adda << " et " << addb << " et " << shift << std::endl;
+ std::cout<<"La distance en memoire ( en octets ) entre les deux variables a et b est : "<< std::hex << shift <<std::endl;
+ return 0;
+}
diff --git a/sem_2/HLIN202/TP/TP5-6/ex7/exo7int b/sem_2/HLIN202/TP/TP5-6/ex7/exo7int
new file mode 100644
index 0000000..640f5cd
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP5-6/ex7/exo7int
Binary files differ
diff --git a/sem_2/HLIN202/TP/TP5-6/ex7/exo7int.cpp b/sem_2/HLIN202/TP/TP5-6/ex7/exo7int.cpp
new file mode 100644
index 0000000..e5b6b83
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP5-6/ex7/exo7int.cpp
@@ -0,0 +1,14 @@
+#include<iostream>
+
+int main () {
+ int a;
+ int table;
+ int chaise;
+ int b;
+ int *adda=&a;
+ int *addb=&b;
+ long *shift = (long*)(addb - adda);
+ std::cout<< adda << " et " << addb << " et " << (int)shift*sizeof(int) << std::endl;
+ std::cout<<"La distance en memoire ( en octets ) entre les deux variables a et b est : " << shift <<std::endl;
+ return 0;
+}
diff --git a/sem_2/HLIN202/TP/TP7-8/ex10/eo10 b/sem_2/HLIN202/TP/TP7-8/ex10/eo10
new file mode 100644
index 0000000..6171fa6
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP7-8/ex10/eo10
Binary files differ
diff --git a/sem_2/HLIN202/TP/TP7-8/ex10/exo10.cpp b/sem_2/HLIN202/TP/TP7-8/ex10/exo10.cpp
new file mode 100644
index 0000000..167ce84
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP7-8/ex10/exo10.cpp
@@ -0,0 +1,118 @@
+#include <iostream>
+
+void affichetab( int taille, int tab[]);
+void inittab ( int taille, int tab[]);
+void inittabsuite ( int taille, int tab[]);
+int min (int a, int b);
+bool prefixe ( int taille1, int taille2, int tab1[],int tab2[]);
+bool tabidentique ( int taille1, int taille2, int tab1[], int tab2[]);
+void bornes ( int taille, int tab[], int* max, int* min);
+bool palindrome ( int taille, int tab[]);
+
+//determine si un tableau de caractere est un palindrome
+bool palindrome ( int taille, char tab[]){
+ char tabinv[taille];
+ for ( int i=0; i< taille; i++){
+ tabinv[i]=tab[taille-i];
+ }
+ for ( int i =0; i<taille; i ++ ){
+ if (tab[i]!=tabinv[i]) {
+ return false;
+ }
+ }
+ return true;
+}
+
+//affiche un tableau de caractere sous la forme d'un mot
+void affichechartab ( int taille, char tab[]) {
+ for ( int i = 0; i< taille; i ++) {
+ std::cout<<tab[i];
+ }
+ std::cout<<std::endl;
+}
+
+//affiche le tableau sous la forme [ x1, x2, x3, x4 ... ]
+void affichetab( int taille, int tab[]) {
+ for ( int i = 0; i < taille; i++) {
+ if (i==0) std::cout<<"[ ";
+ std::cout<<tab[i];
+ if (i!=taille-1) std::cout<<" , ";
+ }
+ std::cout<<" ] " <<std::endl;
+}
+//initialise un tableau de taille n avec toutes ses cases a t[i]=i*i
+void inittab ( int taille, int tab[]){
+ for ( int i =0; i < taille; i++) {
+ tab[i]=i*i;
+ }
+}
+//initialise un tableau avec les valeurs de la suite u0=0 Un+1=Un + 2n + 1
+void inittabsuite ( int taille, int tab[]){
+ tab[0]=0;
+ for (int i =1; i < taille ; i ++) {
+ tab[i]= tab[i-1]+2*(i-1)+1;
+ }
+}
+//determine le minimum de a et b
+int min (int a, int b) {
+ return a<=b? a : b;
+}
+//determine si tab1 est prefixe de tab2 ou si tab2 est prefixe de tab1
+bool prefixe ( int taille1, int taille2, char tab1[],char tab2[]) {
+ if (taille1 != taille2) {
+ return false;
+ }
+ else {
+ int i = 0;
+ while ( i < taille1 && tab1[i]==tab2[i]){
+ i++;
+ }
+ return (i == taille1);
+ }
+ }
+//determine si deux tableau sont identiques
+bool tabidentique ( int taille1, int taille2, int tab1[], int tab2[]){
+ if (taille1==taille2) {
+ int i =0;
+ while ( i < taille1 && tab1[i]==tab2[i]){
+ i++;
+ }
+ return i==taille1;
+ }
+ else {
+ return false;
+ }
+}
+//determine la plus grande et la plus petite valeur du tableau
+void bornes ( int taille, int tab[], int* max, int* min) {
+ *max=tab[0],*min=tab[0];
+ int bctab[taille],bctab2[taille];
+ for (int i=0; i< taille; i ++) {
+ bctab[i]=tab[i];
+ bctab2[i]=tab[i];
+ }
+ for (int i = 0; i < taille-1; i ++ ) {
+ *max = bctab[i] >= bctab[i+1] ? bctab[i]>= *max ? bctab[i] : *max : bctab[i+1]> *max ? bctab[i+1] : *max;
+ *min = bctab2[i] <= bctab2[i+1] ? bctab2[i]<= *min ? bctab2[i] : *min : bctab2[i+1]< *min ? bctab2[i+1] : *min;
+ }
+}
+
+int main () {
+ // int table1[100];
+ // int table2[10];
+ // inittab(100, table1);
+ // inittabsuite(10,table2);
+ // affichetab(100,table1);
+ // affichetab(10,table2);
+ //int *pmin, *pmax;
+ //int max,min;
+ //pmax=&max;
+ //pmin=&min;
+ //bornes ( 100, table,pmax, pmin );
+ if ( prefixe(100,10,table1,table2)) {
+ std::cout<<"les tableaux sont egaux"<<std::endl;
+ }
+ else std::cout<<"Les tableaux sont differents"<<std::endl;
+ //std::cout << "Le max du tableau est " << max << " le min est " << min << std::endl;
+ return 0;
+}
diff --git a/sem_2/HLIN202/TP/TP7-8/ex6/exo6 b/sem_2/HLIN202/TP/TP7-8/ex6/exo6
new file mode 100644
index 0000000..56b1f66
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP7-8/ex6/exo6
Binary files differ
diff --git a/sem_2/HLIN202/TP/TP7-8/ex6/exo6.cpp b/sem_2/HLIN202/TP/TP7-8/ex6/exo6.cpp
new file mode 100644
index 0000000..c0c36ef
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP7-8/ex6/exo6.cpp
@@ -0,0 +1,16 @@
+#include<iostream>
+
+int occurence ( int T[10], int x) {
+ int cpt=0;
+ for ( int i=0; i < 10; i ++) {
+ cpt += T[i]==x ? 1 : 0;
+ }
+ return cpt;
+}
+int main () {
+ int tab[10]= {2,3,4,2,3,1,8,2,5,9};
+ int x=0;
+ std::cout<< " Entrez un entier positif, ce programme calcule le nombre d'occurence de cet entier dans le tableau [2 3 4 2 3 1 8 2 5 9]" << std::endl;
+ std::cin>>x;
+ std::cout<<x << " est present " << occurence(&tab[0], x) << " fois dans le tableau "<<std::endl;
+}
diff --git a/sem_2/HLIN202/TP/TP7-8/ex7/exo7 b/sem_2/HLIN202/TP/TP7-8/ex7/exo7
new file mode 100644
index 0000000..ee26882
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP7-8/ex7/exo7
Binary files differ
diff --git a/sem_2/HLIN202/TP/TP7-8/ex7/exo7.cpp b/sem_2/HLIN202/TP/TP7-8/ex7/exo7.cpp
new file mode 100644
index 0000000..eff59d5
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP7-8/ex7/exo7.cpp
@@ -0,0 +1,22 @@
+#include <iostream>
+#include<math.h>
+
+void codbin ( int x, int tab[32]){
+ for (int i=0; i < 32; i ++) {
+ tab[i]= x < pow(2,32-(i+1)) ? 0 : 1;
+ x = x < pow(2,32-(i+1)) ? x : x- pow(2,32-(i+1));
+ }
+}
+
+int main () {
+ int tab[32];
+ int x;
+ std::cout<< " Entrez un nombre entier positif, ce programme calcule sa valeur en binaire sur 32 bits "<<std::endl;
+ std::cin>>x;
+ codbin(x, &tab[0]);
+ for (int i=0; i < 32; i ++) {
+ std::cout<<tab[i];
+ }
+ std::cout<<std::endl;
+ return 0;
+}
diff --git a/sem_2/HLIN202/TP/TP7-8/ex8/exo8 b/sem_2/HLIN202/TP/TP7-8/ex8/exo8
new file mode 100644
index 0000000..b3cd858
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP7-8/ex8/exo8
Binary files differ
diff --git a/sem_2/HLIN202/TP/TP7-8/ex8/exo8.cpp b/sem_2/HLIN202/TP/TP7-8/ex8/exo8.cpp
new file mode 100644
index 0000000..d12de6e
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP7-8/ex8/exo8.cpp
@@ -0,0 +1,27 @@
+#include<iostream>
+
+int produitscal (int v[], int u[], int d) {
+ int ret=0;
+ for (int i = 0; i < d; i ++) {
+ ret += v[i]*u[i];
+ }
+ return ret;
+}
+
+int main () {
+ int d;
+ std::cout<<"entrez le nombre de composante des vecteurs" << std::endl;
+ std::cin >> d;
+ int v[d], u[d];
+ for (int i=0; i < d; i ++) {
+ std::cout<<"Entrez la valeur "<< i+1 << " de v"<<std::endl;
+ std::cin>>v[i];
+ }
+ for (int i=0; i < d; i ++ ) {
+ std::cout<<"Entrez la valeur "<< i+1 << " de u"<<std::endl;
+ std::cin>>u[i];
+ }
+ std::cout<<"Le produit scalaire de u.v vaut " << produitscal(v,u,d) << std::endl;
+ return 0;
+
+}
diff --git a/sem_2/HLIN202/TP/TP7-8/ex9/exo9 b/sem_2/HLIN202/TP/TP7-8/ex9/exo9
new file mode 100644
index 0000000..55c4d59
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP7-8/ex9/exo9
Binary files differ
diff --git a/sem_2/HLIN202/TP/TP7-8/ex9/exo9.cpp b/sem_2/HLIN202/TP/TP7-8/ex9/exo9.cpp
new file mode 100644
index 0000000..021365f
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP7-8/ex9/exo9.cpp
@@ -0,0 +1,41 @@
+#include<iostream>
+
+void permut ( int tab[], int d, int i) {
+ int Temp[d];
+ for (int j =0; j < d; j ++) {
+ Temp[j]=tab[j];
+ }
+ if ( i > 0) {
+ for (int j = 0; j < d ; j ++) {
+ if (j-i < 0 ) {
+ tab[j]=Temp[d-i+j];
+ }
+ else {
+ tab[j]= Temp[j-i];
+ }
+ }
+ }
+ else if ( i < 0 ) {
+ for (int j = 0; j<d;j ++) {
+ if (j-i==d) {
+ tab[j]=Temp[d+i-j];
+ }
+ else if ( j-i > d) {
+ tab[j]=Temp[d-j];
+ }
+ else {
+ tab[j]=Temp[j-i];
+ }
+ }
+ }
+}
+int main () {
+ int tab[6] = {0,1,2,3,4,5};
+ //Ce programme effectue une rotation de i etapes sur le tableau donné ( le sens change en fonction du signe de i)
+ permut ( tab, 6, 2);
+ for (int i =0; i< 6; i ++) {
+ std::cout<<tab[i]<<" ";
+ }
+ std::cout<<std::endl;
+ return 0;
+}
diff --git a/sem_2/HLIN202/TP/TP7-8/pendu/pendu b/sem_2/HLIN202/TP/TP7-8/pendu/pendu
new file mode 100644
index 0000000..139bd06
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP7-8/pendu/pendu
Binary files differ
diff --git a/sem_2/HLIN202/TP/TP7-8/pendu/pendu.cpp b/sem_2/HLIN202/TP/TP7-8/pendu/pendu.cpp
new file mode 100644
index 0000000..6d38990
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP7-8/pendu/pendu.cpp
@@ -0,0 +1,75 @@
+#include <iostream>
+#include <cstdlib>
+/* HLIN202 TD8 exercice du pendu
+Par Gaspard Coulet ( gaspard.coulet@etu.umontpellier.fr )
+*/
+
+//affiche un tableau de caractere sous la forme d'un mot
+void affichechartab ( int taille, char tab[]) {
+ std::cout<<std::endl;
+ std::cout<<" ";
+ for ( int i = 0; i< taille-1; i ++) {
+ std::cout<<tab[i];
+ }
+ std::cout<<std::endl<<std::endl;
+}
+
+//determine si lettre est appartient a mot, si oui, le revele dans print, et incremente justes
+bool estdansmot ( char lettre, char mot[], int n, char print[], int * justes) {
+ bool ret= false;
+ for ( int i = 0; i < n; i++ ) {
+ if ( mot[i]==lettre) {
+ ret= true;
+ print[i]=lettre;
+ *(justes) += 1;
+ mot[i]='_';
+ }
+ }
+ return ret;
+}
+
+int main () {
+ int vie = 5;
+ int taille;
+ char lettre;
+ int justes=0;
+ std::cout << " Joueur 1 : Entrez la taille du mot a faire deviner " << std::endl;
+ std::cin >> taille;
+ std::cout<<" Joueur 1 : Entrez le mot a faire deviner, puis pressez enter"<< std :: endl;
+ char motdev[taille+1];
+ char backup[taille+1];
+ for (int i=0; i < taille; i ++ ) {
+ std::cin>>motdev[i];
+ backup[i] = motdev[i];
+ }
+ char printed[taille+1];
+ for (int i =0; i < taille; i ++) {
+ printed[i]= '-';
+ }
+ system("clear");
+ affichechartab(taille+1, printed);
+ while ( vie != 0 && justes != taille) {
+ std::cout << " Joueur 2 : Vous avez : " << vie << " vies; Entrez une lettre :"<<std::endl;
+ std::cin >> lettre;
+ system("clear");
+ if (estdansmot(lettre, motdev, taille+1, printed, &justes)) {
+ system("clear");
+ std::cout << " La lettre : " << lettre << " fait est bel est bien dans le mot" << std::endl;
+ affichechartab(taille+1,printed);
+ }
+ else {
+ system("clear");
+ vie --;
+ std::cout<<" La lettre ne fait pas partie du mot, vous perdez une vie, il vous en reste : " << vie << std::endl;
+ affichechartab(taille+1, printed);
+ }
+ }
+ if ( vie == 0) {
+ std::cout<< " Perdu ! Le mot a deviner etait : ";
+ affichechartab(taille+1, backup);
+ }
+ else {
+ std::cout << " Bravo ! Vous avez trouve le mot :) " << std::endl<< std::endl;
+ }
+ return 0;
+}
diff --git a/sem_2/HLIN202/TP/TP9-10/exo b/sem_2/HLIN202/TP/TP9-10/exo
new file mode 100644
index 0000000..651c6fe
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP9-10/exo
Binary files differ
diff --git a/sem_2/HLIN202/TP/TP9-10/exo14/exo14 b/sem_2/HLIN202/TP/TP9-10/exo14/exo14
new file mode 100644
index 0000000..79a0305
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP9-10/exo14/exo14
Binary files differ
diff --git a/sem_2/HLIN202/TP/TP9-10/exo14/exo14.cpp b/sem_2/HLIN202/TP/TP9-10/exo14/exo14.cpp
new file mode 100644
index 0000000..da0c7c5
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP9-10/exo14/exo14.cpp
@@ -0,0 +1,40 @@
+#include<iostream>
+
+int * extraitpairs ( int * tab, int taille, int * taillenew) {
+ *taillenew=0;
+ for (int i = 0; i < taille; i ++){
+ *taillenew += tab[i]%2==0? 1 : 0;
+ }
+ int * tabnew = new int[*taillenew];
+ int j=0;
+ for ( int i =0; i < *taillenew; i ++ ){
+ while ( tab[j] % 2!=0){
+ j ++;
+ }
+ tabnew[i]= tab[j];
+ j++;
+ }
+ return tabnew;
+}
+
+void affichetab ( int *P, int taille) {
+std::cout<<"[";
+for ( int i =0; i <taille ; i++){
+ std::cout<<P[i];
+ if (i != (taille-1)) std::cout<<",";
+}
+std::cout<<"]"<<std::endl;
+}
+
+int main (){
+ int tmp;
+ int *T = new int[4];
+ for (int i=0; i<4; i ++){
+ T[i]= i == 0 ? 1: T[i-1]+1;
+ }
+ int *tabrslt;
+ tabrslt=extraitpairs(T,4,&tmp);
+ affichetab(T,4);
+ affichetab(tabrslt,tmp);
+ return 0;
+}
diff --git a/sem_2/HLIN202/TP/TP9-10/exo6.cpp b/sem_2/HLIN202/TP/TP9-10/exo6.cpp
new file mode 100644
index 0000000..a2c0e6d
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP9-10/exo6.cpp
@@ -0,0 +1,140 @@
+#include<iostream>
+
+int max ( int a, int b) {
+ return a>b? a : b;
+}
+void affichetab ( int *P, int taille) {
+std::cout<<"[";
+for ( int i =0; i <taille ; i++){
+ std::cout<<P[i];
+ if (i != (taille-1)) std::cout<<",";
+}
+std::cout<<"]"<<std::endl;
+}
+
+int* reverse ( int *T, int taille) {
+int *P = new int[taille];
+for ( int i = 0; i < taille; i ++ ) {
+ P[i]= T[taille-i];
+}
+return P;
+}
+
+int* ajoutT ( int *T, int taille, int x) {
+int *P=new int[taille+1];
+bool done=false;
+for (int i =0; i < taille+1; i ++ ) {
+ if ( !done ) {
+ if ( i == taille) {
+ P[taille]= x;
+ done = true;
+ }
+ else if ( x<=T[i]) {
+ P[i]= x;
+ done = true;
+ }
+
+ else {
+ P[i]=T[i];
+ }
+ }
+ else {
+ P[i] = T[i-1];
+ }
+ }
+ return P;
+}
+
+int * fusionT(int * T1, int * T2, int taille1, int taille2) {
+ int *P= new int[taille1+taille2];
+ int j = 0;
+
+ for ( int i = 0; i < taille1; i ++) {
+ P[i]=T1[i];
+ }
+ for (int i = taille1; i <taille1+taille2; i++ ) {
+ P= ajoutT(P, i, T2[j]);
+ j ++;
+ }
+ return P;
+}
+
+void duplicata ( int ** P, int taille) {
+ int *Tmp = new int[taille];
+ int *T = *P;
+ for ( int i = 0; i < taille; i ++) {
+ Tmp[i] = T[i];
+ }
+ delete[] *P;
+ *P= new int[taille*2];
+ T=*P;
+
+ for ( int i = 0; i < taille; i ++) {
+ T[i] = Tmp[i];
+ }
+
+ delete[] Tmp;
+ for (int i = 0; i < taille; i ++) {
+ T[2*taille-i-1]= T[i];
+ }
+}
+int * concat ( int *T1, int *T2, int taille1, int taille2) {
+ int * P = new int[taille1+taille2];
+ for ( int i = 0; i < taille1+taille2; i ++) {
+ if (i < taille1) {
+ P[i]=T1[i];
+ }
+ else {
+ P[i]= T2[i-taille1];
+ }
+ }
+ return P;
+}
+
+int maximum ( int *T, int taille) {
+ if (taille == 1) {
+ return T[0];
+ }
+ int *t1 = new int[taille/2];
+ int *t2 = new int[taille-(taille/2)];
+ for (int i=0; i < taille; i ++) {
+ if ( i < taille/2) {
+ t1[i]= T[i];
+ }
+ else {
+ t2[i-(taille/2)]= T[i];
+ }
+ }
+
+ return max(maximum(t1, taille/2), maximum(t2,(taille-(taille/2))));
+}
+int maximum2 ( int *T, int taille) {
+ if (taille ==1) {
+ return T[0];
+ }
+ else {
+ return max(T[taille-1], maximum2(T, taille-1));
+ }
+}
+int main () {
+// int taille;
+// float somme=0;
+int *tab = new int[4];
+tab[0]= 2;
+tab[1]=3;
+tab[2]=4;
+tab[3]=1;
+/*std::cin>>taille;
+float *P=new float[taille];
+for(int i=0;i<taille;i++){
+ P[i]=(1/(1+(float)i));
+ P[i]*=P[i];
+ somme+=P[i];
+}
+affichetab(P, taille);
+std::cout<<std::endl<<somme<<std::endl;
+*/
+
+std::cout<<maximum2(tab,4);
+return 0;
+}
diff --git a/sem_2/HLIN202/TP/TP9-10/exopart2 b/sem_2/HLIN202/TP/TP9-10/exopart2
new file mode 100644
index 0000000..d37abb8
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP9-10/exopart2
Binary files differ
diff --git a/sem_2/HLIN202/TP/TP9-10/exopart2.cpp b/sem_2/HLIN202/TP/TP9-10/exopart2.cpp
new file mode 100644
index 0000000..cec0725
--- /dev/null
+++ b/sem_2/HLIN202/TP/TP9-10/exopart2.cpp
@@ -0,0 +1,51 @@
+#include <iostream>
+
+float** MatMul ( float ** m1, float ** m2, int m, int n, int p) {
+ float ** ret= new float*[n];
+ for ( int i = 0; i<n;i++){
+ ret[i]=new float[n];
+ }
+ for (int i = 0; i<n;i++){
+ for ( int j=0; j < n; j ++){
+ for ( int k=0; k<m; k ++) {
+ for ( int l=0; l<n;l++){
+ ret[i][j]+= m1[k][l]*m2[l][k];
+ }
+ }
+ }
+ }
+ return ret;
+}
+
+float ** CreerMat ( int m, int n){
+ float **T= new float*[m];
+ for (int i = 0; i < m; i ++) {
+ T[i]= new float[n];
+ }
+ for (int i = 0; i < m; i ++) {
+ for (int j= 0; j <n; j ++) {
+ T[i][j] = 1/(float)(i+j+1);
+ }
+ }
+ return T;
+}
+void afficheMat ( float **Mat, int lignes, int colonnes){
+ for ( int i = 0; i<lignes; i ++) {
+ for (int j = 0; j < colonnes;j++){
+ std::cout<<Mat[i][j]<<" ";
+ }
+ std::cout<<std::endl;
+ }
+ std::cout<<std::endl;
+}
+
+int main () {
+ int m,n;
+ std::cin>>m>>n;
+
+ float **T;
+
+ T=MatMul(CreerMat(m,n),CreerMat(m,n), m,n,n);
+ afficheMat(T, m,n);
+ return 0;
+}