Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<cstdio>
- #include <windows.h>
- using namespace std;
- HANDLE g_hConsol = GetStdHandle(STD_OUTPUT_HANDLE);
- void gotoxy(const int x11, const int y22)
- {
- COORD coord = {x11, y22};
- SetConsoleCursorPosition(g_hConsol, coord);
- }
- int dl=0,zapX;
- int main(){
- system("cls");
- cout<<"Podaj dlugosc piramidki";cin>>dl;
- system("cls");
- for(int y=1;y<=dl;y++){
- for(int x=1;x<=y;x++){
- gotoxy(20-x,y-1);cout<<"X";
- gotoxy(20+x,y-1);cout<<"X";
- }
- gotoxy(20,y-1);cout<<"O";
- }
- for(int y=dl;y>=1;y--){
- for(int x=1;x<=y;x++){
- gotoxy(20+dl*2-x,dl-y);cout<<"X";
- gotoxy(20+dl*2+x,dl-y);cout<<"X";
- }
- gotoxy(20+dl*2,dl-y);cout<<"O";
- }
- getchar();getchar();
- }
Advertisement
Add Comment
Please, Sign In to add comment