Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- void afficherFrise(int n, int l, int h)
- {
- for (int i=0; i<h ; i++)
- {
- for (int j=0; j<=n*l*2; j++)
- {
- if (i == 0)
- {
- if(j%10<l && j!=n*l*2)
- cout << '*';
- else
- cout << ' ';
- }
- else if(i == h-1)
- {
- if(j%10==0)
- cout << '*';
- else if (j%10>=l-1)
- cout << '*';
- else
- cout << ' ';
- }
- else
- {
- if (j%10==0 || j%10 == 5)
- {
- if (j!=n*l*2)
- cout << '*';
- }
- else
- {
- cout << ' ';
- }
- }
- }
- cout << endl;
- }
- }
- int main()
- {
- int r, l, h;
- cout << "Entrer le nombre de répétition" << endl;
- cin >> r;
- cout << "Entrer la demi longueur" << endl;
- cin >> l;
- cout << "Entrer la hauteur" << endl;
- cin >> h;
- afficherFrise(r, l, h);
- return 0;
- }
Add Comment
Please, Sign In to add comment