-
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
作业 #46
Open
csw981001
wants to merge
82
commits into
luckymark:master
Choose a base branch
from
csw981001: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
作业 #46
Changes from all commits
Commits
Show all changes
82 commits
Select commit
Hold shift + click to select a range
2641546
C_level0_c0_chenshuwei
csw981001 283418f
Create c1_1
csw981001 c6b066c
Create c1_1
csw981001 a1f8b7a
Create c1_2
csw981001 8c20a43
Create c1_3
csw981001 e908cc7
Create c1_4
csw981001 8369693
Create c1_5
csw981001 3fd184c
Create c1_6
csw981001 6642610
Create c1_6
csw981001 ca6f204
Create c2_1
csw981001 5bc0147
Create c2_2
csw981001 b57b0a7
Create c2_1.1.1
csw981001 529e150
Create c2_1.1.2
csw981001 c5befae
Create c2_1.1.3
csw981001 dc8d869
Create c2_1.1.4
csw981001 fff07fa
Create c2_1.1.4
csw981001 99bf1fa
Create level0_c3_1.1.6
csw981001 f2e36d8
Create level0_c3_1.1.5.c
csw981001 206bf1c
Create level0_c3_1.1.7.c
csw981001 e4bf745
Rename level0_c3_1.1.5.c to level0_c2_1.1.5.c
csw981001 520e187
Rename level0_c3_1.1.6 to level0_c2_1.1.6
csw981001 7f9fd9f
Rename level0_c3_1.1.7.c to level0_c2_1.1.7.c
csw981001 8f1f954
Rename level0_c2_1.1.6 to level0_c2_1.1.6.c
csw981001 de01525
Create c3_1.c
csw981001 cf6145f
Create level0_c3_2.c
csw981001 e49cc7b
Rename c3_1.c to level0_c3_1.c
csw981001 82a888b
Create level0_c3_3.c
csw981001 66d58f9
Create level0_c3_4.c
csw981001 8d0340a
Create level0_c3_6.c
csw981001 285311b
Create level0_c3_5.c
csw981001 e76548e
Create level0_c3_5.changed.c
csw981001 b796fed
Delete level0_c3_5.changed.c
csw981001 45f6e6b
Create level0_c3_5.changed.c
csw981001 4e2390f
Create level0_c3_5_changed_changed.c
csw981001 0b6b717
Rename practices/c/level0/c0 to practices/ c/ level0/c0.c
csw981001 8cedf75
Rename practices/c/level0/c1_1 to practices/ c/ level0/c1_1.c
csw981001 f47626d
Rename practices/c/level0/c2_2 to practices/ c/ level0/c2_2.c
csw981001 2ae321b
Rename practices/c/level0/c1_2 to practices/ c/ level0/c1_2.c
csw981001 06581aa
Rename practices/c/level0/c1_3 to practices/ c/ level0/c1_3.c
csw981001 78a1c20
Rename c1_4 to c1_4.c
csw981001 10e51d0
Rename practices/c/level0/c1_5 to practices/ c/ level0/c1_5.c
csw981001 5fe6034
Rename practices/c/level0/c2_1.1.1 to practices/ c/ level0/c2_1.1.1.c
csw981001 5eddd99
Rename c2_1.1.4 to c2_1.1.4.c
csw981001 1ac744c
Update and rename c1_6. to c1_6.c
csw981001 9b98a0a
Rename practices/c/level0/c2_1 to practices/ c/ level0/c2_1.c
csw981001 9d9cf3e
Rename practices/c/level0/c2_1.1.2 to practices/ c/ level0/c2_1.1.2.c
csw981001 0fa484e
Rename practices/c/level0/c2_1.1.3 to practices/ c/ level0/c2_1.1.3.c
csw981001 117ef0d
Rename practices/ c/ level0/c1_6 to practices/ c/ level0/c1_6.c
csw981001 680ea73
Delete c1_1
csw981001 128dc1e
Create runningletter.c
csw981001 29d9cfc
Create isprime.c
csw981001 32bef3f
Create Diophantus.c
csw981001 ae978cf
Rename Diophantus.c to Diophants.c
csw981001 438c373
Create shuixian.c
csw981001 f6816bf
Create allprimes.c
csw981001 ac155ee
Create Goldbach.c
csw981001 74f0f07
Create hanoi.c
csw981001 8f23e0c
Update and rename practices/ c/ level1/ p08_hanoi/hanoi.c to practic…
csw981001 b55de5c
list
csw981001 1118318
Create jinxiaoxun
csw981001 2363369
Create pushbox
csw981001 345fbb3
Create maze
csw981001 4317b4d
Update and rename practices/ c/ level1/ p12_warehouse/jinxiaoxun to …
csw981001 531d251
Rename practices/ c/ level1/ p11_linkedList/list to practices/ c/ le…
csw981001 4afca50
Rename practices/ c/ level1/ p12_warehouse/jinxiaoxun to practices/ …
csw981001 6bf494b
Rename practices/ c/ level1/font-font- p10_pushBoxes /font /pushbox t…
csw981001 186e5a9
Rename practices/ c/ level1/ p09_maze/maze to practices/ c/ level1/ …
csw981001 dd935e9
Create queue.cpp
csw981001 7d17655
Update and rename practices/ cpp/ level1/ p01_Queue/queue.cpp to pra…
csw981001 3a66ab8
Create stack.cpp
csw981001 014d82c
Create safearray.cpp
csw981001 419211a
Create canvas.cpp
csw981001 fa1b608
Create CircleAndPoint.cpp
csw981001 db127fb
Create cppScoreManagement.cpp
csw981001 9df2425
Create fighter.cpp
csw981001 ff1c8b6
Update and rename practices/ cpp/ level1/ p11_Fighters/fighter.cpp to…
csw981001 cf36593
Create fighter
csw981001 195d663
Update and rename practices/ cpp/ level1/ p11_Fighters/fighter to pr…
csw981001 019eafb
Create fighter_another.cpp
csw981001 d7cb9bb
Update and rename practices/ cpp/ level1/ p11_Fighters/fighter_anothe…
csw981001 e3c4bcb
Update fighter_another.cpp
csw981001 4a73c4a
Create classes.h
csw981001 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,20 @@ | ||
#include <stdio.h> | ||
void printf_X(int a); | ||
void main() | ||
{ | ||
int i, j; | ||
for (i = 1; i <= 9; i++) | ||
{ | ||
printf_X(i); | ||
printf("\n"); | ||
} | ||
} | ||
|
||
void printf_X(int a) | ||
{ | ||
int j; | ||
for (j = 1; j <= a; j++) | ||
{ | ||
printf("%dX%d=%d\t", a, j, a*j); | ||
} | ||
} |
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,5 @@ | ||
#include <stdio.h> | ||
void main() | ||
{ | ||
printf("Hello,world!我是陈叔炜"); | ||
} |
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,21 @@ | ||
#include <stdio.h> | ||
int main() | ||
{ | ||
int a; | ||
printf("请输入一个数"); | ||
scanf("%d", &a); | ||
if (a > 0) | ||
{ | ||
printf("这个数是正数"); | ||
} | ||
else if (a != 0) | ||
{ | ||
printf("这个数是负数"); | ||
} | ||
else printf("这个数既不是正数也不是负数"); | ||
if (0 == a % 2) | ||
{ | ||
printf("这个数是偶数"); | ||
} | ||
else printf("这个数是奇数"); | ||
} |
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,13 @@ | ||
#include <stdio.h> | ||
int main() | ||
{ | ||
int a; | ||
printf("请输入一个数"); | ||
scanf("%d", &a); | ||
if (0 == a % 13) | ||
{ | ||
printf("这个数是13的倍数"); | ||
} | ||
else | ||
printf("这个数不是13的倍数"); | ||
} |
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,11 @@ | ||
#include <stdio.h> | ||
int main() | ||
{ | ||
int a; | ||
printf("请输入年数"); | ||
scanf("%d", &a); | ||
if ((0 == a % 4 && 0 != a % 100) || 0 == a % 400) | ||
printf("这一年是闰年"); | ||
else | ||
printf("这一年不是闰年"); | ||
} |
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,20 @@ | ||
#include <stdio.h> | ||
int main() | ||
{ | ||
int a, b, c; | ||
printf("请输入三个数"); | ||
scanf("%d%d%d", &a, &b, &c); | ||
if (a > b) | ||
{ | ||
if (c > a) | ||
a = c; | ||
} | ||
else | ||
{ | ||
if (b > c) | ||
a = b; | ||
else | ||
a = c; | ||
} | ||
printf("这三个数中最大的是%d", a); | ||
} |
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,17 @@ | ||
#include <stdio.h> | ||
int main() | ||
{ | ||
int i,n,max_number=0; | ||
printf("请输入要比较的数的个数"); | ||
scanf("%d", &n); | ||
int number; | ||
for (i = 0; i < n; i++) | ||
{ | ||
scanf("%d", &number); | ||
if (number > max_number) | ||
{ | ||
max_number = number; | ||
} | ||
} | ||
printf("这n个数中最大的数是%d", max_number); | ||
} |
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,12 @@ | ||
#include <stdio.h> | ||
int main() | ||
{ | ||
int i; | ||
for (i = 2; i <= 200; i++) | ||
{ | ||
if (0 == i % 2) | ||
{ | ||
printf("%d\t", i); | ||
} | ||
} | ||
} |
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,12 @@ | ||
#include <stdio.h> | ||
int main() | ||
{ | ||
int i; | ||
for (i = 1; i <= 100; i++) | ||
{ | ||
if ((0 == i % 3) && (0 != i % 5)) | ||
{ | ||
printf("%d\t", i); | ||
} | ||
} | ||
} |
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,13 @@ | ||
#include <stdio.h> | ||
void main() | ||
{ | ||
int i, sum = 0; | ||
for (i = 1; i <= 100; i++) | ||
{ | ||
if ((0 == i % 7) || (7 == i % 10)) | ||
{ | ||
printf("%d\t", i); | ||
sum += i; | ||
} | ||
} | ||
} |
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,11 @@ | ||
#include <stdio.h> | ||
#include <windows.h> | ||
void main() | ||
{ | ||
int i,t=50; | ||
for (i = 0; i < 10000; i++) | ||
{ | ||
printf("你好"); | ||
Sleep(t); | ||
} | ||
} |
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,13 @@ | ||
#include <stdio.h> | ||
void main() | ||
{ | ||
system("color 0a"); | ||
while (1) | ||
{ | ||
printf("0 1"); | ||
} | ||
} | ||
//结果分析 | ||
//结果:屏幕无限制打印绿色字体的‘0’、‘1’ | ||
//system ("color 0a")使字体变绿 | ||
//while 语句条件表达式为1,代表真,无限执行循环“打印绿色字体0 1” |
117 changes: 117 additions & 0 deletions
117
practices/ c/ level1/ font-font- p10_pushBoxes/ font/pushbox.c
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,117 @@ | ||
#include<stdio.h> | ||
#include<stdlib.h> | ||
#include<conio.h> | ||
#define SIZE 9 | ||
int intmaze[SIZE][SIZE]; | ||
void print_map(); | ||
void scanfmap(); | ||
void move(int nn); | ||
void main() | ||
{ | ||
scanfmap(); | ||
move(SIZE); | ||
system("pause"); | ||
} | ||
|
||
void scanfmap() | ||
{ | ||
FILE *p; | ||
p =fopen("level1.txt", "r"); | ||
for (int i = 0; i < SIZE; i++) { | ||
for (int j= 0; j < SIZE; j++) { | ||
fscanf(p, "%d", &intmaze[i][j]); | ||
} | ||
} | ||
fclose(p); | ||
} | ||
void print_map() | ||
{ | ||
for (int i = 0; i < SIZE; i++) { | ||
for (int j = 0; j < SIZE; j++) { | ||
if (intmaze[i][j] == 0) { | ||
intmaze[i][j] = ' '; //空格 | ||
}if (intmaze[i][j] == 1) { | ||
intmaze[i][j] = '*'; //墙壁 | ||
}if (intmaze[i][j] == 9) { | ||
intmaze[i][j] = 'P'; //人 | ||
}if (intmaze[i][j]== 2) { | ||
intmaze[i][j] = '@'; //目的地; | ||
}if (intmaze[i][j]== 3) { | ||
intmaze[i][j] = '#'; //箱子 | ||
} | ||
} | ||
} | ||
for (int i = 0; i < SIZE; i++) { | ||
for (int j = 0; j < SIZE; j++) { | ||
printf("%c", intmaze[i][j]); | ||
} | ||
printf("\n"); | ||
} | ||
} | ||
|
||
void move(int nn) | ||
{ | ||
int x = 4, y = 4; | ||
char walk; | ||
while (1) { | ||
print_map(); | ||
walk = _getch(); | ||
if (walk == 'w') { | ||
if ((intmaze[x - 1][y] == ' ') && (x>0)) { | ||
intmaze[x - 1][y] = 9; | ||
intmaze[x][y] = 0; | ||
x--; | ||
} | ||
else if ((intmaze[x - 1][y] == '#') && (intmaze[x - 2][y] != '*') && (x > 1)) { | ||
intmaze[x - 1][y] = 9; | ||
intmaze[x - 2][y] = 3; | ||
intmaze[x][y] = 0; | ||
x--; | ||
} | ||
} | ||
if (walk == 's') { | ||
if ((intmaze[x + 1][y] == ' ') && (x < nn - 1)) { | ||
intmaze[x + 1][y] = 9; | ||
intmaze[x][y] = 0; | ||
x++; | ||
} | ||
else if ((intmaze[x + 1][y] == '#') && (intmaze[x + 2][y] != '*') && (x < nn - 2)) { | ||
intmaze[x + 1][y] = 9; | ||
intmaze[x + 2][y] = 3; | ||
intmaze[x][y] = 0; | ||
x++; | ||
} | ||
} | ||
if (walk == 'a'){ | ||
if ((intmaze[x][y - 1] == ' ') && (y > 0)) { | ||
intmaze[x][y - 1] = 9; | ||
intmaze[x][y] = 0; | ||
y--; | ||
} | ||
else if ((intmaze[x][y - 1] == '#') && (intmaze[x][y - 2] != '*') && (y>1)) { | ||
intmaze[x][y - 1] = 9; | ||
intmaze[x][y - 2] = 3; | ||
intmaze[x][y] = 0; | ||
y--; | ||
} | ||
} | ||
if (walk == 'd') { | ||
if ((intmaze[x][y + 1] == ' ') && (y < nn - 1)) { | ||
intmaze[x][y + 1] = 9; | ||
intmaze[x][y] = 0; | ||
y++; | ||
} | ||
else if ((walk == 'd') && (intmaze[x][y + 1] == '#') && (intmaze[x][y + 2] != '*') && (y < nn - 2)) { | ||
intmaze[x][y + 1] = 9; | ||
intmaze[x][y + 2] = 3; | ||
intmaze[x][y] = 0; | ||
y++; | ||
} | ||
} | ||
system("cls"); | ||
if (intmaze[1][4] != '@' && intmaze[4][1] != '@' && intmaze[7][4] != '@' && intmaze[4][7] != '@') { | ||
printf("YOU WIN\n"); | ||
break; | ||
} | ||
} | ||
} |
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,26 @@ | ||
#include<stdio.h> | ||
#include<windows.h> | ||
int for_back_word(int a); | ||
const int n = 120; | ||
int main() | ||
{ | ||
int i; | ||
for (i = 1; i < n; i++) { | ||
for_back_word(i); | ||
} | ||
for (i; i > 0; i--) { | ||
for_back_word(i); | ||
} | ||
return 0; | ||
} | ||
|
||
int for_back_word(int a) | ||
{ | ||
int j,m=100; | ||
for (j = 1; j < a; j++) { | ||
printf(" "); | ||
} | ||
printf("R"); | ||
Sleep(m); | ||
system("cls"); | ||
} |
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,35 @@ | ||
#include<stdio.h> | ||
#include<math.h> | ||
int is_prime(int a); | ||
int main() | ||
{ | ||
int x; | ||
scanf_s("%d", &x); | ||
if (is_prime(x)) { | ||
printf("%d is a prime", x); | ||
} | ||
else { | ||
printf("%d is not a prime", x); | ||
} | ||
return 0; | ||
} | ||
|
||
int is_prime(int a) | ||
{ | ||
int k; | ||
if (a == 1) { | ||
return 0; | ||
}if (a == 2) { | ||
return 1; | ||
}if (a > 2) { | ||
for (k = 2; k <= sqrt(a); k++) { | ||
if (a%k == 0) { | ||
return 0; | ||
break; | ||
} | ||
else { | ||
return 1; | ||
} | ||
} | ||
} | ||
} |
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,11 @@ | ||
#include<stdio.h> | ||
int main() | ||
{ | ||
int x; | ||
for (x = 1; x <= 150; x++) { | ||
if (x*(1 / 6.0 + 1 / 7.0 + 1 / 12.0) + 5 + x / 2.0 + 4 == x) { | ||
printf("%d", x-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,11 @@ | ||
#include<stdio.h> | ||
int main() | ||
{ | ||
int x; | ||
for (x = 1; x <= 150; x++) { | ||
if (x*(1 / 6.0 + 1 / 7.0 + 1 / 12.0) + 5 + x / 2.0 + 4 == x) { | ||
printf("%d", x-4); | ||
} | ||
} | ||
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.
文件名后缀应该是.c
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.
已经修改了 俸爷有空看看