Advertisement
ElenaMednikova

Untitled

Nov 6th, 2019
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.92 KB | None | 0 0
  1. 5.2
  2. #include <iostream>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. int n, i, x;
  9. cin>>n;
  10. for(x = 0; x <= n; x++)
  11. {
  12. if(x%2==0)
  13. {
  14. for(i = 0; i <= 2*n; i++)
  15. {
  16. cout<<"/"; }
  17. cout<<endl;
  18. }
  19. else if(x%2==1)
  20. {
  21. for(i = 0; i <= 2*n; i++)
  22. {
  23. cout<<"\\";}
  24. cout<<endl;
  25. }
  26. }
  27. return 0;
  28. }
  29. 5.1
  30. #include <iostream>
  31.  
  32. using namespace std;
  33.  
  34. int main()
  35. {
  36. int n;
  37. cin>>n;
  38. long xf = 1;
  39. for(int x = 1; x <= n; x++)
  40. {
  41. xf = x * xf;
  42. cout << x << "!=" << xf << endl;
  43. }
  44. return 0;
  45. }
  46. 5.3
  47. #include <iostream>
  48.  
  49. using namespace std;
  50.  
  51. int main()
  52. {
  53. int n;
  54. cin>>n;
  55. n/=2;
  56. for(int x = 0; x < n; x++)
  57. {
  58. cout<<string(x, '*')<<string(n * 2 - 2 * x, ' ')<<string(x, '*')<<endl;
  59. }
  60. for(int x = n; x > 0; x--)
  61. {
  62. cout<<string(x, '*')<<string(n * 2 - 2 * x, ' ')<<string(x, '*')<<endl;
  63. }
  64. return 0;
  65. }
  66. 5.4
  67. #include <iostream>
  68.  
  69. using namespace std;
  70.  
  71. int main()
  72. {
  73. int n;
  74. cin>>n;
  75. n/=2;
  76. for(int x = 1; x < n; x++)
  77. {
  78. cout<<string(x, '*')<<string(n * 2 - 2 * x, ' ')<<string(x, '*')<<string(x-1, '*')<<endl;
  79. }
  80. for(int x = n; x > 0; x--)
  81. {
  82. cout<<string(x, '*')<<string(n * 2 - 2 * x, ' ')<<string(x, '*')<<string(x-1, '*')<<endl;
  83. }
  84. return 0;
  85. }
  86. хееех
  87. #include <iostream>
  88. using namespace std;
  89. int main(){
  90. char flowers = '*', wall = 'n', tree = '^';
  91. int h = 9;
  92. int l = 36, wall_l = 9, tree_l = 9, flower_l = l - wall_l;
  93. int blank = l - (wall_l + tree_l);
  94. int y = 1, x1, x2;
  95. if (h%2==1){
  96. x2 = h/2 + 1; x1 = h - x2;
  97. }
  98. else{
  99. x2 = h/2;
  100. x1 =x2;
  101. }
  102. for (int x = 1; x<=x1; x++)
  103. {
  104. cout<<string(x, wall)<<string(wall_l - 2 * x, ' ')<<string(x, wall)<<string(blank, ' ')<<string((tree_l - 2 * x)/2, ' ')<<string(y, tree)<<string((tree_l - 2 *x)/2, ' ')<<endl;
  105. y+=2;
  106. }
  107. y=1;
  108. blank-=1;
  109. tree_l+=1;
  110. for (int x = 1; x<=x2; x++)
  111. {
  112. cout<<string(wall_l, wall)<<string(blank, ' ')<<string((tree_l - 2*x)/2, ' ')<<string(y, tree)<<string((tree_l - 2*x)/2, ' ')<<endl;
  113. y+=2;
  114. }
  115. cout<<string(wall_l, wall)<<string(flower_l,flowers)<<endl;
  116. return 0;
  117. }
  118. уоалуоацоауож
  119. using namespace std;
  120. int main(){
  121. char flowers = '*', wall = 'n', tree = '^';
  122.  
  123. int l = 36, wall_l = 9, tree_l = 9, flower_l = l - wall_l;
  124. int blank = l - (wall_l + tree_l);
  125. int y = 1, x1, x2;
  126.  
  127. for (int x = 1; x<=4; x++)
  128. {
  129. cout<<string(x, wall)<<string(wall_l - 2 * x, ' ')<<string(x, wall)<<string(blank, ' ')<<string((tree_l - 2 * x)/2, ' ')<<string(y, tree)<<string((tree_l - 2 *x)/2, ' ')<<endl;
  130. y+=2;
  131. }
  132. y=1;
  133. blank-=1;
  134. tree_l+=1;
  135. for (int x = 1; x<=5; x++)
  136. {
  137. cout<<string(wall_l, wall)<<string(blank, ' ')<<string((tree_l - 2*x)/2, ' ')<<string(y, tree)<<string((tree_l - 2*x)/2, ' ')<<endl;
  138. y+=2;
  139. }
  140. cout<<string(wall_l, wall)<<string(flower_l,flowers)<<endl;
  141. cout<<string(11, ' ')<<"It's very bad"<<string(11, ' ')<<endl;
  142. return 0;
  143. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement