#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
//a图
for(int i=1;i<=10;i++)
{
for(int j=1;j<=i;j++)
{
cout<<"*";
}
cout<<endl;
}
cout<<endl<<endl;
//b图
for(int i=1;i<=10;i++)
{
for(int j=10;j>=i;j--)
{
cout<<"*";
}
cout<<endl;
}
cout<<endl<<endl;
//c图
for(int i=1;i<=10;i++)
{
string str="";
for(int j=10;j>=i;j--)
{
str+="*";
}
cout<<right<<setw(10)<<str<<endl;
}
cout<<endl<<endl;
//d图
for(int i=1;i<=10;i++)
{
string str="";
for(int j=1;j<=i;j++)
{
str+="*";
}
cout<<right<<setw(10)<<str<<endl;
}
return 0;
}
效果如下