New course! Every coder should learn Generative AI!
Try a free lesson+ 13
#include <iostream>
using namespace std;
int main()
{
int size = 7, mid = (size / 2) + 1;
for(int i = 1; i <= size; i++)
{
for(int j = 1; j <= (size + 1); j++)
{
if(((i == (mid - 1)) && (j == (size + 1))) || ((i == (mid + 1)) && (j == 1)))
cout << " ";
else if(i == 1 || i == size || j == 1 || j == (size + 1) || i == mid)
cout << "*";
else
cout << " ";
}
cout << endl;
}
return 0;
}
You can change size of the letter by changing the value of the variable size.
The value must be odd for perfect shape and minimum odd number you can enter is 7.
+ 10
Here you go, find the bug
/Edit: fixed it
https://code.sololearn.com/cAt0Aqz8JJtX/?ref=app