Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main()
- {
- int N;
- cin >> N;
- char star = '*';
- char emptySpace = ' ';
- int emptySpaceQuantity = N - 2;
- for (int i = 1; i <= N; i++) {
- if (i == 1) {
- cout << string(N, star) << endl;
- }
- else if (i < N) {
- cout << star << string(emptySpaceQuantity, emptySpace) << star << endl;
- }
- else if (i == N) {
- cout << string(N, star) << endl;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement