joj1009

来源:互联网 发布:只有我知bilibili双语 编辑:程序博客网 时间:2024/06/14 16:19

 

  • #include <iostream>
  • #include <string>
  • using namespace std;
  • int main ()
  • {
  • int n,i,j;
  • char ch,h;
  • int temp=1;
  • while (cin>>n,n)
  • {
  • if(temp!=1)
  • {cout<<endl;}
  • j=0;
  • ch='a';
  • //if(n==0) break;
  • for(i=1;i<=n;i++)
  • {
  • h=ch+j%26;
  • cout<<h;
  • j++;
  • temp++;
  • }
  • cout<<endl;
  •  
  • for(i=2;i<=n-1;i++)
  • {
  • h=ch+j%26;
  • cout<<string(n-i,' ')<<h++;
  • cout<<endl;
  • j++;
  • temp++;
  • }
  •  
  • for(i=1;i<=n;i++)
  • {
  • h=ch+j%26;
  • cout<<h++;
  • j++;
  • temp++;
  • }
  • cout<<endl;
  • }
  • return 0;
  • }
  •