Open
Conversation
Author
|
05-07 |
luckymark
reviewed
Mar 8, 2017
Owner
luckymark
left a comment
There was a problem hiding this comment.
我暂时看到这里,请自己把后面的类似问题一并修改了,我再继续看
| for (j = 0; j < i; j++) | ||
| { | ||
| printf (" "); | ||
| } |
| int i,j; | ||
| system("mode con cols=16 lines=9"); | ||
| int width = GetSystemMetrics ( SM_CXSCREEN ); | ||
| for (i = 0; i < 16; i++) |
| printf ("%c", c); | ||
| Sleep (100); | ||
| } | ||
| for(i = 15; i >= 0; i--) |
| for (i = 2; i < n; i++) | ||
| { | ||
| if(n % i == 0) | ||
| break; |
Owner
There was a problem hiding this comment.
没有缩进;
因为是短路语句,此处不换行也很好,like this:if(n % i == 0) break;
如果换行的话,最好用大括号包起来;
| break; | ||
| } | ||
| if(i == n) | ||
| printf ("%d is a prime\n", n); |
| int main(void) | ||
| { | ||
| int i; | ||
| for (i=100; i < 1000; i++) |
Owner
There was a problem hiding this comment.
循环变量
哦,对了,需要修改编译选项才行,-std=c99,你的IDE里怎么设置,可以在群里咨询
| @@ -0,0 +1,34 @@ | |||
| #include <stdio.h> | |||
Owner
There was a problem hiding this comment.
目前是C语言的作业,不能使用cpp做后缀,也不能使用c++的语法
| { | ||
| float start, finish; | ||
| start = clock(); | ||
| bool prime[N]; |
| for(int i = 2; i < N; i++) | ||
| { | ||
| if(prime[i]) | ||
| for(int j = i * 2; j < N; j += i) |
| for(int i = 2; i < N; i++) | ||
| { | ||
| if(prime[i]) | ||
| for(int j = i * 2; j < N; j += i) |
Author
|
= = |
Author
|
add 08-09 |
Author
|
好久没提交作业了。。。。不是因为懒,而是恶补。。。 |
Author
|
继续写。。。 |
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.
No description provided.