-
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
再次尝试 #43
Open
ahadou
wants to merge
12
commits into
luckymark:master
Choose a base branch
from
ahadou: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
再次尝试 #43
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
325566b
完成了running letter
d32e9e8
1
c4f37f2
2
b2a8cc6
3
5fbf301
level 1
fe538e3
修修改后
74c8110
C++第一次作作业
660b967
栈2.0
af9913b
5
a70f336
6
5f064be
fighter
63ca7af
final
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,25 @@ | ||
#include<stdio.h> | ||
#include<windows.h> | ||
#define BOUNDRY 80 | ||
|
||
void move(int m); | ||
|
||
void main() | ||
{ | ||
for ( int i = 0;i < BOUNDRY;i++) { | ||
move(i); | ||
} | ||
for (int i = BOUNDRY;i >= 0;i--) { | ||
move(i); | ||
} | ||
} | ||
|
||
void move(int m) | ||
{ | ||
Sleep(50); | ||
system("cls"); | ||
for (int j = 0;j < m - 1;j++) { | ||
printf(" "); | ||
} | ||
printf("R"); | ||
} |
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,36 @@ | ||
#include<stdio.h> | ||
|
||
int main() | ||
{ | ||
long int i, j; | ||
|
||
printf("Please input a number: \t"); | ||
scanf_s("%d", &i); | ||
|
||
if (i == 2) { | ||
printf("%d is a Prime.", i); | ||
} | ||
else if (i == 1) { | ||
printf("%d is not a Prime.", i); | ||
} | ||
else { | ||
j = 2; | ||
while (i > j) { | ||
if (i%j == 0) { | ||
break; | ||
} | ||
else { | ||
if (i == j + 1) { | ||
printf("%d is a Prime.", i); | ||
break; | ||
} | ||
j++; | ||
|
||
} | ||
} | ||
|
||
if (i > j + 1) { | ||
printf("%d is not a Prime.", 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,16 @@ | ||
#include<stdio.h> | ||
int main() | ||
{ | ||
int i, j, k, l; | ||
for (i = 100;i < 1000;i++) | ||
{ | ||
k = i % 10; | ||
j = (i % 100) / 10; | ||
l = i / 100; | ||
if (i == (k*k*k) + (j*j*j) + (l*l*l)) | ||
{ | ||
printf("%5d", i); | ||
} | ||
} | ||
return 0; | ||
} |
Binary file not shown.
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> | ||
|
||
void main() | ||
{ | ||
int one, ten, hun; | ||
|
||
for (int num= 100;num < 1000;num++) | ||
{ | ||
one = num % 10; | ||
ten = (num % 100) / 10; | ||
hun = num / 100; | ||
if (num == (one*one*one) + (ten*ten*ten) + (hun*hun*hun)) | ||
{ | ||
printf("%5d", num); | ||
} | ||
} | ||
} |
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,31 @@ | ||
#include<stdio.h> | ||
#include <time.h> | ||
|
||
int main() | ||
{ | ||
clock_t start, finish; | ||
double duration; | ||
|
||
start = clock(); | ||
printf(" 2"); | ||
for (int i = 2;i <= 1000;i++) | ||
{ | ||
int j = 2; | ||
while (i > j) { | ||
if (i%j == 0) { | ||
break; | ||
} | ||
else { | ||
if (i == j + 1) { | ||
printf("%5d", i); | ||
break; | ||
} | ||
j++; | ||
|
||
} | ||
} | ||
} | ||
finish = clock(); | ||
duration = (finish - start)*1.0 / CLOCKS_PER_SEC; | ||
printf("\n程序运行时间为:%lfs", duration); | ||
} |
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,40 @@ | ||
#include<stdio.h>; | ||
|
||
void main() | ||
{ | ||
int t = 1, m, n; | ||
int num[101] = { 0 }; | ||
int prime[26]; | ||
|
||
for (int a = 2;a <= 10;a++) { | ||
if (num[a] == 0) { | ||
for (int b = 2 * a;b <= 100;b += a) | ||
num[b] = 1; | ||
} | ||
} | ||
|
||
for (int a = 2;a <= 100;a++) { | ||
if (num[a] == 0) { | ||
prime[t] = a; | ||
t += 1; | ||
} | ||
} | ||
|
||
for (m = 1;m <= 50;m++) { | ||
n = 2 * m; //n��ʾ100���ڵ�ż���� | ||
for (int p = 1;p <= 26;p++) { | ||
for (int d = 1;d <= p;d++) { | ||
if (n == prime[p] + prime[d]) | ||
printf("%2d=%2d+%2d\t", n, prime[p], prime[d]); | ||
} | ||
} | ||
} | ||
printf("\n\n"); | ||
|
||
if (m = 50) { | ||
printf("��ˣ���100���ڸ�°ͺղ�����ȷ��"); | ||
} | ||
else { | ||
printf("��ˣ���100���ڸ�°ͺղ��벻��ȷ��"); | ||
} | ||
} |
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,68 @@ | ||
#include<stdio.h> | ||
#include<stdlib.h> | ||
void encrypt(); | ||
void decrypt(); | ||
|
||
int L = 5; | ||
char k, ch; | ||
char* p; | ||
int count = 0; | ||
|
||
int main() | ||
{ | ||
p = (char*)malloc(sizeof(char) * L); | ||
printf("��ѡ����������ܻ��ǽ���:a������ b������\n"); | ||
k = getch(); | ||
if (k == 'a') { | ||
encrypt(); | ||
} | ||
|
||
|
||
else if (k == 'b') { | ||
decrypt(); | ||
} | ||
else { | ||
printf("���������Ϣ����."); | ||
return 0; | ||
} | ||
} | ||
|
||
|
||
void encrypt() | ||
{ | ||
printf("������������ܵ��ַ���: "); | ||
do | ||
{ | ||
ch = getchar(); | ||
count++; | ||
if (count >= L) { | ||
p = (char*)realloc(p, sizeof(char*) * (++L)); | ||
} | ||
p[count - 1] = (char)((int)ch + 4); | ||
} while (ch != '\n'); | ||
printf("��һ������%d���ַ�\n���ܺ������Ϊ��", count - 1); | ||
for (int i = 0;i < count;i++) { | ||
printf("%c", p[i]); | ||
} | ||
free(p); | ||
} | ||
|
||
|
||
void decrypt() | ||
{ | ||
printf("������������ܵ��ַ���: "); | ||
do | ||
{ | ||
ch = getchar(); | ||
count++; | ||
if (count >= L) { | ||
p = (char*)realloc(p, sizeof(char*) * (++L)); | ||
} | ||
p[count - 1] = (char)((int)ch - 4); | ||
} while (ch != '\n'); | ||
printf("��һ������%d���ַ�\n���ܺ������Ϊ��", count - 1); | ||
for (int i = 0;i < count;i++) { | ||
printf("%c", p[i]); | ||
} | ||
free(p); | ||
} |
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,28 @@ | ||
#include<stdio.h> | ||
#include<windows.h> | ||
void gotoxy(int x, int y); | ||
|
||
int main() | ||
{ | ||
boundry(); | ||
|
||
} | ||
|
||
void boundry() | ||
{ | ||
gotoxy(20, 20); | ||
printf("1"); | ||
gotoxy(20, 22); | ||
printf("2"); | ||
gotoxy(20, 24); | ||
printf("3"); | ||
gotoxy(20, 26); | ||
printf("4"); | ||
} | ||
void gotoxy(int x, int y)//ָ光标控制函数 | ||
{ | ||
COORD c; | ||
c.X = x; | ||
c.Y = y; | ||
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), c); | ||
} |
Binary file not shown.
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,123 @@ | ||
##define _CRT_SECURE_NO_WARNINGS//大神教的 | ||
#include<stdio.h> | ||
#include<stdlib.h> | ||
|
||
void turn_up(); | ||
void turn_down(); | ||
void turn_left(); | ||
void turn_right(); | ||
void show(); | ||
|
||
char map[22][22]; | ||
int x = 20, y = 0; | ||
int point = 'R'; | ||
|
||
int main() | ||
{ | ||
int i=0, j=0; | ||
char *p; | ||
char step; | ||
p = map[0]; | ||
FILE *fp; | ||
fp = fopen("mazemap.txt", "r"); | ||
|
||
if (fp == NULL) { | ||
printf("can't open"); | ||
exit(1); | ||
} | ||
|
||
for (;p < map[0] + 484;p++) { | ||
fscanf_s(fp, "%c", p); | ||
if ((p - map[0]) % 22 == 0) { | ||
i += 1; | ||
j = 0; | ||
} | ||
j++; | ||
} | ||
map[x][y] = 'R';; | ||
show(); | ||
|
||
while (x > 0 || y < 20) { | ||
step = _getch(); | ||
switch (step) { | ||
case 'w': { | ||
turn_up(); | ||
break; | ||
} | ||
case 'a': { | ||
turn_left(); | ||
break; | ||
} | ||
case 'd': { | ||
turn_right(); | ||
break; | ||
} | ||
case 's': { | ||
turn_down(); | ||
break; | ||
} | ||
} | ||
} | ||
system("cls"); | ||
printf(" That's cool , you have win!\n"); | ||
getchar(); | ||
} | ||
|
||
|
||
void show() | ||
{ | ||
for (int i = 0;i < 22;i++) { | ||
for (int j = 0;j < 22;j++) { | ||
printf("%c", map[i][j]); | ||
if (j == 21)printf("\n"); | ||
} | ||
} | ||
} | ||
|
||
|
||
void turn_up() | ||
{ | ||
if (map[x - 1][y] != '*') { | ||
map[x][y] = ' '; | ||
map[x - 1][y] = point; | ||
system("cls"); | ||
show(); | ||
x = x - 1; | ||
} | ||
} | ||
|
||
|
||
void turn_left() | ||
{ | ||
if (map[x][y - 1] != '*') { | ||
map[x][y] = ' '; | ||
map[x][y - 1] = point; | ||
system("cls"); | ||
show(); | ||
y = y - 1; | ||
} | ||
} | ||
|
||
|
||
void turn_right() | ||
{ | ||
if (map[x][y + 1] != '*') { | ||
map[x][y] = ' '; | ||
system("CLS"); | ||
map[x][y + 1] = point; | ||
show(); | ||
y = y + 1; | ||
} | ||
} | ||
|
||
|
||
void turn_down() | ||
{ | ||
if (map[x + 1][y] != '*') { | ||
map[x][y] = ' '; | ||
map[x + 1][y] = point; | ||
system("cls"); | ||
show(); | ||
x += 1; | ||
} | ||
} |
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.
这个程序是什么鬼?