-
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
Open
Zhenwen-NLP
wants to merge
11
commits into
luckymark:master
Choose a base branch
from
Zhenwen-NLP:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
89d6af0
1.3.4.5.6
21f8a5c
Revert "1.3.4.5.6"
975dccd
Homework 1-8 test
Zhenwen-NLP 07f36b3
Homework 1-8 test
Zhenwen-NLP e20f475
Revert "Homework 1-8 test"
Zhenwen-NLP 5ef0244
test
Zhenwen-NLP da8183a
Second Edition
Zhenwen-NLP 768be0e
Second Submission
Zhenwen-NLP e8385c5
Third
Zhenwen-NLP b863925
homework
097e78e
fighter
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#include <stdio.h> | ||
int main(int argc, char** argv) | ||
{ | ||
int fatherAge=0; | ||
for(double i=1.0;i<100;i++) //�������� | ||
{ | ||
for(double j=1;j<200;j++) //�������� | ||
{ | ||
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; | ||
break; | ||
} | ||
} | ||
} | ||
printf("������ʱ����ͼ����Ϊ%d",FatherAge-4); | ||
return 0; | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#include <stdio.h> | ||
#include <string.h> | ||
#include <stdlib.h> | ||
|
||
void Encrypte(char* p) | ||
{ | ||
int i = 0; | ||
while (p[i] != '\0') | ||
{ | ||
p[i] = p[i] + '3' - '1'; | ||
printf("%c", p[i]); | ||
i++; | ||
} | ||
printf("\n"); | ||
} | ||
|
||
void Decrypte(char* p) | ||
{ | ||
int i = 0; | ||
while (p[i] != '\0') | ||
{ | ||
p[i] = p[i] - '3' + '1'; | ||
printf("%c", p[i]); | ||
i++; | ||
} | ||
printf("\n"); | ||
} | ||
|
||
int main() | ||
{ | ||
char p[10000]; | ||
int Judge = 0; | ||
printf("Please input the string need opreating\n"); | ||
scanf("%s", p); | ||
printf("En or De?\nPleaes input 1(En) or 2(De)\n"); | ||
scanf("%d", &Judge); | ||
if (Judge == 1) | ||
{ | ||
Encrypte(p); | ||
} | ||
else if (Judge == 2) | ||
{ | ||
Decrypte(p); | ||
} | ||
else | ||
{ | ||
printf("Input Error!"); | ||
return -1; | ||
} | ||
return 0; | ||
} | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
#include <stdio.h> | ||
|
||
/*int pd(int n) | ||
{ | ||
for(int i=2;i<=n/2;i++) //This program is used for drawing a table | ||
{ | ||
if(n%i==0) | ||
return 0; | ||
} | ||
return 1; | ||
} | ||
|
||
|
||
int main(int argc, char** argv) | ||
{ | ||
int a[100]; | ||
int tot=0; | ||
printf("a[0]=2\n"); | ||
for(int i=3;i<100;i++) | ||
{ | ||
if(pd(i)) | ||
{ | ||
a[tot++]=i; | ||
printf("a[%d]=%d;\n",tot,i); | ||
} | ||
} | ||
return 0; | ||
} */ | ||
|
||
int main() | ||
{ | ||
int a[25]; //��� | ||
int judge = 0; | ||
a[0] = 2; | ||
a[1] = 3; | ||
a[2] = 5; | ||
a[3] = 7; | ||
a[4] = 11; | ||
a[5] = 13; | ||
a[6] = 17; | ||
a[7] = 19; | ||
a[8] = 23; | ||
a[9] = 29; | ||
a[10] = 31; | ||
a[11] = 37; | ||
a[12] = 41; | ||
a[13] = 43; | ||
a[14] = 47; | ||
a[15] = 53; | ||
a[16] = 59; | ||
a[17] = 61; | ||
a[18] = 67; | ||
a[19] = 71; | ||
a[20] = 73; | ||
a[21] = 79; | ||
a[22] = 83; | ||
a[23] = 89; | ||
a[24] = 97; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 哈哈,一个个写的呀,好累哦。这种脏活累活就交给计算机来处理嘛 2333 |
||
for (int i = 4; i <=100; i+=2) | ||
{ | ||
for (int j = 0; j < 25; j++) | ||
{ | ||
for (int k = 0; k < 25; k++) | ||
{ | ||
if (a[j] + a[k] == i) | ||
{ | ||
judge = 1; | ||
break; | ||
} | ||
} | ||
if (judge==1) | ||
{ | ||
cout << i << "�����°ͺղ���" << endl; | ||
break; | ||
} | ||
else if (judge==0) | ||
{ | ||
return -1; | ||
printf("Goldbach do not exists"); | ||
} | ||
judge = 0; | ||
} | ||
return 0; | ||
} | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#include <stdio.h> | ||
#include <windows.h> | ||
|
||
int main(int argc, char** argv) | ||
{ | ||
int i = 0; | ||
int j = 0; | ||
while (1) | ||
{ | ||
printf("R"); | ||
Sleep(30); | ||
system("cls"); | ||
int op = 1; | ||
for (i = 0; i<79&&i>=0; i+=op) | ||
{ | ||
for (j = 0; j < i; j++) | ||
{ | ||
printf(" "); | ||
} | ||
printf("R"); | ||
Sleep(30); | ||
system("cls"); | ||
if (i == 78) | ||
{ | ||
op = -1; | ||
} | ||
if (i == 0) | ||
{ | ||
op = 1; | ||
} | ||
} | ||
} | ||
return 0; | ||
} |
Oops, something went wrong.
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.
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