Guest User

Untitled

a guest
Jan 21st, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3.  
  4. void afficherFrise(int n, int l, int h)
  5. {
  6. for (int i=0; i<h ; i++)
  7. {
  8. for (int j=0; j<=n*l*2; j++)
  9. {
  10. if (i == 0)
  11. {
  12. if(j%10<l && j!=n*l*2)
  13. cout << '*';
  14. else
  15. cout << ' ';
  16. }
  17. else if(i == h-1)
  18. {
  19. if(j%10==0)
  20. cout << '*';
  21. else if (j%10>=l-1)
  22. cout << '*';
  23. else
  24. cout << ' ';
  25.  
  26. }
  27. else
  28. {
  29. if (j%10==0 || j%10 == 5)
  30. {
  31. if (j!=n*l*2)
  32. cout << '*';
  33. }
  34. else
  35. {
  36. cout << ' ';
  37. }
  38. }
  39. }
  40. cout << endl;
  41. }
  42. }
  43.  
  44. int main()
  45. {
  46. int r, l, h;
  47. cout << "Entrer le nombre de répétition" << endl;
  48. cin >> r;
  49. cout << "Entrer la demi longueur" << endl;
  50. cin >> l;
  51. cout << "Entrer la hauteur" << endl;
  52. cin >> h;
  53. afficherFrise(r, l, h);
  54. return 0;
  55. }
Add Comment
Please, Sign In to add comment