📄 3_4.cpp
字号:
#include<iostream.h>
int main()
{
void print(char ch);
char ch;
do
{
cout<<"请输入一个字母!"<<endl;
cin>>ch;
}while(!(ch>='A'&&ch<='Z'||ch>='a'&&ch<='z'));
print(ch);
return(0);
}
void print(char ch)
{
int i,j,k;
char c,d;
if(ch>='A'&&ch<='Z')
c='A';
else
c='a';
k=ch-c+1;
for(i=1;i<=k;i++)
{
for(j=1;j<=k-i;j++)
cout<<" ";
for(j=1;j<=i;j++)
{
d=c+j-1;
cout<<d;
}
for(j=i-1;j>=1;j--)
{
d=c+j-1;
cout<<d;
}
cout<<endl;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -