C++中 打印一些字符图形的循环代码
打印字符图形
int main()
{
for(int i=1;i<=10;++i)
{
for(int j=1;j<=10-i;++j)
cout<<" ";
for(char ch='A';ch<='A'+2*i-2;++ch)
cout<
cout<<"/n";
}
}
A
ABC
ABCDE
ABCDEFG
ABCDEFGHI
ABCDEFGHIJK
ABCDEFGHIJKLM
ABCDEFGHIJKLMNO
ABCDEFGHIJKLMNOPQ
ABCDEFGHIJKLMNOPQRS
int main(){
for(int i=1;i<=10;++i)
{
for(int j=1;j<=i;++j)
cout<<"M";
cout<
}
}
M
MM
MMM
MMMM
MMMMM
MMMMMM
MMMMMMM
MMMMMMMM
MMMMMMMMM
MMMMMMMMMM
int main(){
for(int i=1;i<=10;++i){
for(int j=1;j<=i-1;++j)
cout<<" ";
for(int k=1;k<=21-2*i;++k)
cout<<"M";
cout<
}
}
MMMMMMMMMMMMMMMMMMM
MMMMMMMMMMMMMMMMM
MMMMMMMMMMMMMMM
MMMMMMMMMMMMM
MMMMMMMMMMM
MMMMMMMMM
MMMMMMM
MMMMM
MMM
M
int main(){
for(int i=1;i<=10;++i)
{
for(int j=1;j<=10-i;++j)
cout<<" ";
for(int k=1;k<=2*i-1;++k)
cout<<"%";
cout<<"/n";
/*cout<
}
for(int a=1;a<=9;++a)
{
for(int b=1;b<=a;++b)
cout<<" ";
for(int c =1;c<=19-2*a;++c)
cout<<"%";
cout<
}
}
%
%%%
%%%%%
%%%%%%%
%%%%%%%%%
%%%%%%%%%%%
%%%%%%%%%%%%%
%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%
%%%%%%%%%%%%%
%%%%%%%%%%%
%%%%%%%%%
%%%%%%%
%%%%%
%%%
%
int main(){
for(int i=1;i<=10;++i){
for(int j=1;j<=10-i;++j)
cout<<" ";
for(int k=1;k<=i;++k)
cout<<"#";
cout<<" ";
for(int m=1;m<=i;++m)
cout<<"$";
}
cin.get();
}
# $
## $$
### $$$
#### $$$$
##### $$$$$
###### $$$$$$
####### $$$$$$$
######## $$$$$$$$
######### $$$$$$$$$
########## $$$$$$$$$$
int main()
{
for(int i=1;i<=9;++i){
for(int j=1;j<=i-1;++j)
cout<<" ";
for(int k=1;k<=10-i;++k)
cout<<"ST";
cout<<"S";
cout<<"/n";
//.cout<
}
cout<<" ";
cout<<"S";
}
STSTSTSTSTSTSTSTSTS
STSTSTSTSTSTSTSTS
STSTSTSTSTSTSTS
STSTSTSTSTSTS
STSTSTSTSTS
STSTSTSTS
STSTSTS
STSTS
STS
S
Copyright@ 2011-2017 版权所有:大连仟亿科技有限公司 辽ICP备11013762-1号 google网站地图 百度网站地图 网站地图
公司地址:大连市沙河口区中山路692号辰熙星海国际2215 客服电话:0411-39943997 QQ:2088827823 42286563
法律声明:未经许可,任何模仿本站模板、转载本站内容等行为者,本站保留追究其法律责任的权利! 隐私权政策声明