diff options
| author | Gaspard Coulet <gaspard.coulet@mines-ales.org> | 2021-04-28 23:05:53 +0200 |
|---|---|---|
| committer | Gaspard Coulet <gaspard.coulet@mines-ales.org> | 2021-04-28 23:05:53 +0200 |
| commit | 9fe033ea88c2f705ec18c232873d056e0c229d72 (patch) | |
| tree | 0647dc8c51610c7336c88c04de2068ea14b21e17 /sem_2/HLIN202/TP/TP3-4/ex9 | |
Initial commit
Diffstat (limited to 'sem_2/HLIN202/TP/TP3-4/ex9')
| -rw-r--r-- | sem_2/HLIN202/TP/TP3-4/ex9/exo9 | bin | 0 -> 9276 bytes | |||
| -rw-r--r-- | sem_2/HLIN202/TP/TP3-4/ex9/exo9.cpp | 29 |
2 files changed, 29 insertions, 0 deletions
diff --git a/sem_2/HLIN202/TP/TP3-4/ex9/exo9 b/sem_2/HLIN202/TP/TP3-4/ex9/exo9 Binary files differnew file mode 100644 index 0000000..490551d --- /dev/null +++ b/sem_2/HLIN202/TP/TP3-4/ex9/exo9 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;
+}
|
