Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int n;
- cout <<"Unesite broj n: ";
- do
- {
- cin >> n;
- }
- while(n < 5 || n > 24);
- for(int i = 0; i < n; i++)
- {
- if(i==0 || i==n-1)
- {
- cout<<"+";
- for(int j=0; j<2*n; j++)
- {
- cout<<"-";
- }
- cout<<"+";
- cout<<endl;
- }
- else if(i ==1 || i==n-2)
- {
- cout<<"|";
- for(int j=0; j<2*n; j++)
- {
- cout<<" ";
- }
- cout<<"|";
- cout<<endl;
- }
- else if(i==2 || i ==n-3)
- {
- cout<<"| +";
- for(int j=0; j<(2*(n-2))-2; j++)
- {
- cout<<"-";
- }
- cout<<"+ |";
- cout<<endl;
- }
- else
- {
- cout<<"| |";
- for(int j=0; j<(2*(n-2))-2; j++)
- {
- cout<<" ";
- }
- cout<<"| |";
- cout<<endl;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement