-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Homework from Liangzhenwen #52
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
无论是驼峰命名法还是unix的那种,普通变量一般首字母不大写哈
Diophantus.c
Outdated
@@ -0,0 +1,18 @@ | |||
#include <iostream> | |||
using namespace std; | |||
int main(int argc, char** argv) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 这里加个换行符,增加可读性
- 文件后缀是.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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
如果找到父亲的年龄了,那么是不是就可以退出循环了那?
Goldbach.c
Outdated
@@ -0,0 +1,54 @@ | |||
#include <iostream> | |||
using namespace std; | |||
int main() |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 通常情况下,变量首字母小写,常量会全部大写
- bool类型只有c++里面才有哦 俸爷要求用c写哦
allPrimes.c
Outdated
#include <time.h> | ||
/*bool pd(int n) | ||
{ | ||
for(int i=2;i<=n/2;i++) //�˳��������� |
There was a problem hiding this comment.
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; | ||
} */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
感觉这部分注释代码才是应该提交的。。 2333
Encrypted.c
Outdated
int main() | ||
{ | ||
char p[10000]; | ||
int Judge = 0; |
There was a problem hiding this comment.
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); | ||
} |
There was a problem hiding this comment.
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
Encrypted.c
Outdated
#include <stdio.h> | ||
#include <string.h> | ||
#include <stdlib.h> | ||
void Encrypte(char* p) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
method上面还是加个换行哈,增加可读性 不要都挤在一起
两个质数表都是用程序打出来的 这样输出素数更快,但缺点是不适用于大数量的素数,2-1000还是可以的
level1 1-8