summaryrefslogtreecommitdiff
path: root/sem_2/HLIN202/TP/TP1
diff options
context:
space:
mode:
Diffstat (limited to 'sem_2/HLIN202/TP/TP1')
-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
10 files changed, 74 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;
+}