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 +++++++++++++++++ 3 files changed, 17 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 (limited to 'sem_2/HLIN202/TP/TP2/ex10') 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"<