我有一道题错了,帮我改改

2025-01-04 08:16:07
推荐回答(2个)
回答1:

# include
# define SIZEX 25
# define SIZEY 18
using namespace std;
int main()
{
int i,j;
int count=0;
for(i=0;i {
count=i;
while(count)
{
cout<<(char)(count+'A');
count--;
if(i-count==SIZEY)
{
break;
}
}
for(j=0;j {
cout<<(char)(j+'A');
}
cout< }

return 0;
}

看看这个亲,应该是没问题的

ABCDEFGHIJKLMNOPQR
BABCDEFGHIJKLMNOPQ
CBABCDEFGHIJKLMNOP
DCBABCDEFGHIJKLMNO
EDCBABCDEFGHIJKLMN
FEDCBABCDEFGHIJKLM
GFEDCBABCDEFGHIJKL
HGFEDCBABCDEFGHIJK
IHGFEDCBABCDEFGHIJ
JIHGFEDCBABCDEFGHI
KJIHGFEDCBABCDEFGH
LKJIHGFEDCBABCDEFG
MLKJIHGFEDCBABCDEF
NMLKJIHGFEDCBABCDE
ONMLKJIHGFEDCBABCD
PONMLKJIHGFEDCBABC
QPONMLKJIHGFEDCBAB
RQPONMLKJIHGFEDCBA
SRQPONMLKJIHGFEDCB
TSRQPONMLKJIHGFEDC
UTSRQPONMLKJIHGFED
VUTSRQPONMLKJIHGFE
WVUTSRQPONMLKJIHGF
XWVUTSRQPONMLKJIHG
YXWVUTSRQPONMLKJIH

回答2:

#include
using namespace std;
void main(){
for (int i=0;i<25;i++)
{
for(int j=0;j printf("%c",(char)('A')+i-j);
for(j=i;j<18;j++)
printf("%c",(char)('A')-i+j);
printf("\n");
}
system("pause");
}