您的位置:首页 > 其它

打印字母金字塔

2017-04-19 18:42 232 查看
#include<iostream>

using namespace std;

void Print() {
for(int i='A';i<='Z';i++) {
int k='Z';
int p='B';
int count1=26;
int count2=25;
while(count1>0){
if(k>i) {
cout<<" ";
} else {
cout<<(char)k;
}
k--;
count1--;
}

while(count2>0){
if(p>i) {
cout<<" ";
} else {
cout<<(char)p;
}
p++;
count2--;
}
cout<<endl;
}
}

int main() {
Print();
return 0;
}

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  while 循环