Skip to content

Conversation

@MagicVicCoder
Copy link

No description provided.

@MagicVicCoder MagicVicCoder changed the title 汉诺塔 曹思瀚 Oct 2, 2023
#include <stdio.h>
#include <windows.h>

#define RIGHT 00
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

为什么是00不是0呢?有什么特别的讲究吗?


HANDLE hd;
int width,dir=RIGHT;
void move(int x,int y)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

习惯上,我们只在前面写上函数原型,函数实现移到下面

{
COORD pos={x,y};
SetConsoleCursorPosition(hd,pos);
return;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个return是多余的吧

CONSOLE_SCREEN_BUFFER_INFO info;
GetConsoleScreenBufferInfo(hd,&info);
width=info.srWindow.Right;
return;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同上

}
int ne(int now)
{
if(dir==RIGHT)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

感觉可以简化为一行,反而逻辑更清晰

now=ne(now);
move(now,0);
printf("a");
Sleep(25);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

幻数

int sum=0;
scanf("%d %d",&m,&n);
if(m==1){
m=2;}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可以格式化一下

}
printf("num=%d\n",num);
int t,k,j,m,n,CNT=0;
for(t=6;t<=100;t++){
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

感觉逻辑有点乱,不能一目了然

k=t-a[i];
for(j=0;j<num;j++){
m=k-a[j];
for(n=0;n<num;n++){
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

嵌套太深

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants