Skip to content

Homework from Liangzhenwen#52

Open
Zhenwen-NLP wants to merge 11 commits intoluckymark:masterfrom
Zhenwen-NLP:master
Open

Homework from Liangzhenwen#52
Zhenwen-NLP wants to merge 11 commits intoluckymark:masterfrom
Zhenwen-NLP:master

Conversation

@Zhenwen-NLP
Copy link
Copy Markdown

level1 1-8

Copy link
Copy Markdown
Collaborator

@gutouyu gutouyu left a comment

Choose a reason for hiding this comment

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

看到汉诺塔了

Diophantus.c Outdated
using namespace std;
int main(int argc, char** argv)
{
int FatherAge=0;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

无论是驼峰命名法还是unix的那种,普通变量一般首字母不大写哈

@@ -0,0 +1,18 @@
#include <iostream>
using namespace std;
int main(int argc, char** argv)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

  1. 这里加个换行符,增加可读性
  2. 文件后缀是.c 怎么开头就是两行c++哦,不要干这种披着c外衣的c++哈

Diophantus.c Outdated
{
if((1.0/6.0*j+1.0/12.0*j+1.0/7.0*j+5+i+4==j)&&(2*i==j))
{
FatherAge=j;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

如果找到父亲的年龄了,那么是不是就可以退出循环了那?

@@ -0,0 +1,54 @@
#include <iostream>
using namespace std;
int main()
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

main上面加个换行,增加可读性

Goldbach.c Outdated
int main()
{
int a[25]; //���
bool Judge = 0;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

  1. 通常情况下,变量首字母小写,常量会全部大写
  2. bool类型只有c++里面才有哦 俸爷要求用c写哦

allPrimes.c Outdated
#include <time.h>
/*bool pd(int n)
{
for(int i=2;i<=n/2;i++) //�˳����������
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

这里循环结束最优不是n/2 而是sqrt(n),不注意就弄错了哈

}
}
return 0;
} */
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

感觉这部分注释代码才是应该提交的。。 2333

int main()
{
char p[10000];
int Judge = 0;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

变量名开头小写

else if (Judge == 2)
{
Decrypte(p);
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

对于if elseif结构,最后要有一个else接住剩下的情况,这里就可以提示用户输入不对,只能输入1或者2

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
void Encrypte(char* p)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

method上面还是加个换行哈,增加可读性 不要都挤在一起

Zhenwen-NLP and others added 5 commits March 13, 2017 12:12
两个质数表都是用程序打出来的 这样输出素数更快,但缺点是不适用于大数量的素数,2-1000还是可以的
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