From 9fe033ea88c2f705ec18c232873d056e0c229d72 Mon Sep 17 00:00:00 2001 From: Gaspard Coulet Date: Wed, 28 Apr 2021 23:05:53 +0200 Subject: Initial commit --- sem_2/HLIN202/TP/TP2/ex10/exo10-1 | Bin 0 -> 9293 bytes sem_2/HLIN202/TP/TP2/ex10/exo10-2 | Bin 0 -> 9350 bytes sem_2/HLIN202/TP/TP2/ex10/exo10-2.cpp | 17 +++++++++++++++++ sem_2/HLIN202/TP/TP2/ex11/exo11 | Bin 0 -> 9293 bytes sem_2/HLIN202/TP/TP2/ex11/exo11.cpp | 15 +++++++++++++++ sem_2/HLIN202/TP/TP2/ex7/exo7 | Bin 0 -> 9294 bytes sem_2/HLIN202/TP/TP2/ex7/exo7.cpp | 27 +++++++++++++++++++++++++++ sem_2/HLIN202/TP/TP2/ex8/exo8 | Bin 0 -> 9297 bytes sem_2/HLIN202/TP/TP2/ex8/exo8.cpp | 13 +++++++++++++ sem_2/HLIN202/TP/TP2/ex9/exo91 | Bin 0 -> 9293 bytes sem_2/HLIN202/TP/TP2/ex9/exo91.cpp | 14 ++++++++++++++ sem_2/HLIN202/TP/TP2/ex9/exo92 | Bin 0 -> 9293 bytes sem_2/HLIN202/TP/TP2/ex9/exo92.cpp | 14 ++++++++++++++ 13 files changed, 100 insertions(+) create mode 100644 sem_2/HLIN202/TP/TP2/ex10/exo10-1 create mode 100644 sem_2/HLIN202/TP/TP2/ex10/exo10-2 create mode 100644 sem_2/HLIN202/TP/TP2/ex10/exo10-2.cpp create mode 100644 sem_2/HLIN202/TP/TP2/ex11/exo11 create mode 100644 sem_2/HLIN202/TP/TP2/ex11/exo11.cpp create mode 100644 sem_2/HLIN202/TP/TP2/ex7/exo7 create mode 100644 sem_2/HLIN202/TP/TP2/ex7/exo7.cpp create mode 100644 sem_2/HLIN202/TP/TP2/ex8/exo8 create mode 100644 sem_2/HLIN202/TP/TP2/ex8/exo8.cpp create mode 100644 sem_2/HLIN202/TP/TP2/ex9/exo91 create mode 100644 sem_2/HLIN202/TP/TP2/ex9/exo91.cpp create mode 100644 sem_2/HLIN202/TP/TP2/ex9/exo92 create mode 100644 sem_2/HLIN202/TP/TP2/ex9/exo92.cpp (limited to 'sem_2/HLIN202/TP/TP2') 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 Binary files /dev/null and b/sem_2/HLIN202/TP/TP2/ex10/exo10-1 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 Binary files /dev/null and b/sem_2/HLIN202/TP/TP2/ex10/exo10-2 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 + +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"<=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"< + +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 "<> a >>n; + x = a; + do { + y = x; + x = y/2 + a/(2*y); + std::cout< + +int main(){ + int a,b,c,min,max; + std::cout<<"Entrez 3 entiers, ce programme donnera le minimum et le maximum des trois"<> 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 Binary files /dev/null and b/sem_2/HLIN202/TP/TP2/ex8/exo8 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 + +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 < + +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 < + +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" <> n >> deb; + for (int i=deb; i <= n; i ++) { + reslt += 1.0/i; + } + std::cout<<"Le resultat est : "<< reslt <