三角
#include<iostream> using namespace std; int main(){ int i,j,k; char ch; for(i=1;i<=10;i++){ ch='A'; for(j=1;j<=10-i;++j){ cout<<" "; } for(k=1;k<=2*i-1;++k){ cout<<ch; ch++; } cout<<endl; } return 0; }
菱形
#include<iostream> using namespace std; int main(){ int i,j,k; char ch; for(i=1;i<=10;i++){ ch='A'; for(j=1;j<=10-i;++j){ cout<<" "; } for(k=1;k<=2*i-1;++k){ cout<<ch; ch++; } cout<<endl; } for(i=9;i>=1;i--){ ch='A'; for(j=1;j<=10-i;++j){ cout<<" "; } for(k=1;k<=2*i-1;++k){ cout<<ch; ch++; } cout<<endl; } return 0; }
平行四边形
#include<iostream> using namespace std; int main(){ int i,j,k; char ch; for(i=10;i>=0;i--){ ch='A'; for(j=1;j<=10-i;++j){ cout<<" "; } for(k=1;k<=10;++k){ cout<<ch; if(k==11-j){ cout<<'|'; } ch++; } cout<<endl; } return 0; }标签:std,字符,ch,int,namespace,char,图画,main From: https://www.cnblogs.com/wangyueshuo/p/18076166