Preview:
#include<iostream>
#include<cmath>
#include<iomanip>


using namespace std;
int main(){

    for(int r=1;r<=9;r++){
        for(int s=0;s<=r-1;s++){
            cout<<' ';}
            for(int c=1;c<=(11-2*r);c++){
        if(r==1 || r==9) cout<<'*';
        else if(c==1 || c==(11-2*r)){cout<<'*';}
        else cout<<' ';
            }
            cout<<endl;
        
    }
   

return 0;
}
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter