Open
Conversation
gutouyu
reviewed
Mar 12, 2017
Diophantus.c
Outdated
| using namespace std; | ||
| int main(int argc, char** argv) | ||
| { | ||
| int FatherAge=0; |
Collaborator
There was a problem hiding this comment.
无论是驼峰命名法还是unix的那种,普通变量一般首字母不大写哈
| @@ -0,0 +1,18 @@ | |||
| #include <iostream> | |||
| using namespace std; | |||
| int main(int argc, char** argv) | |||
Collaborator
There was a problem hiding this comment.
- 这里加个换行符,增加可读性
- 文件后缀是.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; |
Collaborator
There was a problem hiding this comment.
如果找到父亲的年龄了,那么是不是就可以退出循环了那?
| @@ -0,0 +1,54 @@ | |||
| #include <iostream> | |||
| using namespace std; | |||
| int main() | |||
Goldbach.c
Outdated
| int main() | ||
| { | ||
| int a[25]; //��� | ||
| bool Judge = 0; |
Collaborator
There was a problem hiding this comment.
- 通常情况下,变量首字母小写,常量会全部大写
- bool类型只有c++里面才有哦 俸爷要求用c写哦
allPrimes.c
Outdated
| #include <time.h> | ||
| /*bool pd(int n) | ||
| { | ||
| for(int i=2;i<=n/2;i++) //�˳���������� |
Collaborator
There was a problem hiding this comment.
这里循环结束最优不是n/2 而是sqrt(n),不注意就弄错了哈
| } | ||
| } | ||
| return 0; | ||
| } */ |
| int main() | ||
| { | ||
| char p[10000]; | ||
| int Judge = 0; |
| else if (Judge == 2) | ||
| { | ||
| Decrypte(p); | ||
| } |
Collaborator
There was a problem hiding this comment.
对于if elseif结构,最后要有一个else接住剩下的情况,这里就可以提示用户输入不对,只能输入1或者2
| #include <stdio.h> | ||
| #include <string.h> | ||
| #include <stdlib.h> | ||
| void Encrypte(char* p) |
Collaborator
There was a problem hiding this comment.
method上面还是加个换行哈,增加可读性 不要都挤在一起
两个质数表都是用程序打出来的 这样输出素数更快,但缺点是不适用于大数量的素数,2-1000还是可以的
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
level1 1-8