Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- KWADRAT
- #include <iostream>
- using namespace std;
- int main()
- {
- int h;
- cin>>h;
- for(int n=1;n<=h;n++)
- {
- for(int k=1; k<=n;k++)
- cout<<"X";
- for(int i=1; i<=h-n;i++)
- cout<<"X";
- cout<<endl;
- }
- return 0;
- }
- CHOINKA
- #include <iostream>
- using namespace std;
- int main()
- {
- int n;
- cout<<"Z ilu linii ma skladac sie choinka?"<<endl;
- cin>>n;
- for(int b=1;b<=n;b++)
- {
- for(int c=1;c<=n-b;c++)
- {
- cout<<" ";
- }
- for(int c=1;c<=b*2-1;c++)
- {
- cout <<"+";
- }
- cout<<endl;
- }
- for(int d=1;d<=2;d++)
- {
- for(int d=1;d<=n-1;d++)
- {
- cout <<" ";
- }
- cout<<"#\n";
- }
- return 0;
- }
- SCHODY W LEWO
- #include <iostream>
- using namespace std;
- int main()
- {
- int h;
- cin>>h;
- for(int n=1;n<=h;n++)
- {
- for(int k=1; k<=n;k++)
- cout<<"X";
- for(int i=1; i<=h-n;i++)
- cout<<" ";
- cout<<endl;
- }
- return 0;
- }
- SCHODY W PRAWO
- #include <iostream>
- using namespace std;
- int main()
- {
- int h;
- cin>>h;
- for(int n=1;n<=h;n++)
- {
- for(int i=1; i<=h-n;i++)
- cout<<" ";
- for(int k=1; k<=n;k++)
- cout<<"X";
- cout<<endl;
- }
- return 0;
- }
- KWADRAT PUSTY W SRODKU
- #include <iostream>
- using namespace std;
- int wysokosc,szerokosc;
- int main()
- {
- cout<<"Podaj szerokosc prostokata:"; cin>>szerokosc;
- cout<<"Podaj szerokosc wysokosc:"; cin>>wysokosc;
- for(int i=1;i<=szerokosc;i++)
- {
- cout<<"X";
- }
- cout<<endl;
- for(int i=1;i<=wysokosc-2;i++)
- {
- cout<<"X";
- for(int a=1;a<=szerokosc-2;a++)
- {
- cout<<" ";
- }
- cout<<"X";
- cout<<endl;
- }
- for(int i=1;i<=szerokosc;i++)
- {
- cout<<"X";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement