summaryrefslogtreecommitdiff
path: root/sem_2/HLIN202/TP/TP2/ex10
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/TP2/ex10
Initial commit
Diffstat (limited to 'sem_2/HLIN202/TP/TP2/ex10')
-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
3 files changed, 17 insertions, 0 deletions
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;
+}
+