Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 5.2
- #include <iostream>
- using namespace std;
- int main()
- {
- int n, i, x;
- cin>>n;
- for(x = 0; x <= n; x++)
- {
- if(x%2==0)
- {
- for(i = 0; i <= 2*n; i++)
- {
- cout<<"/"; }
- cout<<endl;
- }
- else if(x%2==1)
- {
- for(i = 0; i <= 2*n; i++)
- {
- cout<<"\\";}
- cout<<endl;
- }
- }
- return 0;
- }
- 5.1
- #include <iostream>
- using namespace std;
- int main()
- {
- int n;
- cin>>n;
- long xf = 1;
- for(int x = 1; x <= n; x++)
- {
- xf = x * xf;
- cout << x << "!=" << xf << endl;
- }
- return 0;
- }
- 5.3
- #include <iostream>
- using namespace std;
- int main()
- {
- int n;
- cin>>n;
- n/=2;
- for(int x = 0; x < n; x++)
- {
- cout<<string(x, '*')<<string(n * 2 - 2 * x, ' ')<<string(x, '*')<<endl;
- }
- for(int x = n; x > 0; x--)
- {
- cout<<string(x, '*')<<string(n * 2 - 2 * x, ' ')<<string(x, '*')<<endl;
- }
- return 0;
- }
- 5.4
- #include <iostream>
- using namespace std;
- int main()
- {
- int n;
- cin>>n;
- n/=2;
- for(int x = 1; x < n; x++)
- {
- cout<<string(x, '*')<<string(n * 2 - 2 * x, ' ')<<string(x, '*')<<string(x-1, '*')<<endl;
- }
- for(int x = n; x > 0; x--)
- {
- cout<<string(x, '*')<<string(n * 2 - 2 * x, ' ')<<string(x, '*')<<string(x-1, '*')<<endl;
- }
- return 0;
- }
- хееех
- #include <iostream>
- using namespace std;
- int main(){
- char flowers = '*', wall = 'n', tree = '^';
- int h = 9;
- int l = 36, wall_l = 9, tree_l = 9, flower_l = l - wall_l;
- int blank = l - (wall_l + tree_l);
- int y = 1, x1, x2;
- if (h%2==1){
- x2 = h/2 + 1; x1 = h - x2;
- }
- else{
- x2 = h/2;
- x1 =x2;
- }
- for (int x = 1; x<=x1; x++)
- {
- 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;
- y+=2;
- }
- y=1;
- blank-=1;
- tree_l+=1;
- for (int x = 1; x<=x2; x++)
- {
- cout<<string(wall_l, wall)<<string(blank, ' ')<<string((tree_l - 2*x)/2, ' ')<<string(y, tree)<<string((tree_l - 2*x)/2, ' ')<<endl;
- y+=2;
- }
- cout<<string(wall_l, wall)<<string(flower_l,flowers)<<endl;
- return 0;
- }
- уоалуоацоауож
- using namespace std;
- int main(){
- char flowers = '*', wall = 'n', tree = '^';
- int l = 36, wall_l = 9, tree_l = 9, flower_l = l - wall_l;
- int blank = l - (wall_l + tree_l);
- int y = 1, x1, x2;
- for (int x = 1; x<=4; x++)
- {
- 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;
- y+=2;
- }
- y=1;
- blank-=1;
- tree_l+=1;
- for (int x = 1; x<=5; x++)
- {
- cout<<string(wall_l, wall)<<string(blank, ' ')<<string((tree_l - 2*x)/2, ' ')<<string(y, tree)<<string((tree_l - 2*x)/2, ' ')<<endl;
- y+=2;
- }
- cout<<string(wall_l, wall)<<string(flower_l,flowers)<<endl;
- cout<<string(11, ' ')<<"It's very bad"<<string(11, ' ')<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement