-
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
完成running letter #37
Open
lazyJane
wants to merge
6
commits into
luckymark:master
Choose a base branch
from
lazyJane: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
完成running letter #37
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
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,29 @@ | ||
#include<stdio.h> | ||
#include<windows.h> | ||
#define TIMES 50 | ||
int main(void) | ||
{ | ||
int i,j; | ||
|
||
for(i=1;i<TIMES;i++) | ||
{ | ||
for(j=1;j<i;j++) | ||
{ | ||
printf(" "); | ||
} | ||
printf("R"); | ||
Sleep(200); | ||
system("cls"); | ||
} | ||
for(i=TIMES;i>0;i--) | ||
{ | ||
for(j=1;j<i;j++) | ||
{ | ||
printf(" "); | ||
} | ||
printf("R"); | ||
Sleep(200); | ||
system("cls"); | ||
} | ||
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,23 @@ | ||
#include <stdio.h> | ||
int main(void) | ||
{ | ||
int num; | ||
int i,j; | ||
|
||
printf("����һ����������"); | ||
while((scanf("%d",&num)==1)) | ||
{ | ||
for(i=2,j=1;(i*i)<num;i++) | ||
{ | ||
if(num%i==0) | ||
{ | ||
printf("%d��������.\n",num); | ||
j=0; | ||
break; | ||
} | ||
} | ||
if(j==1) | ||
printf("%d������",num); | ||
} | ||
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,17 @@ | ||
#include <stdio.h> | ||
int main(void) | ||
{ | ||
float years=0; | ||
float childhood,young,single; | ||
|
||
while(years<200) | ||
{ | ||
childhood=(float)years/6; | ||
young=(float)years/7; | ||
single=(float)years/12; | ||
if(years==(childhood+young+single+5+4)*2) | ||
printf("������ʱ����ͼΪ%d��.\n",(int)years-4); | ||
years++; | ||
} | ||
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,18 @@ | ||
#include <stdio.h> | ||
int main(void) | ||
{ | ||
int a,b,c; | ||
int num; | ||
|
||
for(a=1;a<=9;a++){ | ||
for(b=0;b<=9;b++){ | ||
for(c=0;c<=9;c++){ | ||
num=a*100+b*10+c; | ||
if(num==(a*a*a+b*b*b+c*c*c)){ | ||
printf("%d\n",num); | ||
} | ||
} | ||
} | ||
} | ||
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,24 @@ | ||
#include <stdio.h> | ||
#include <time.h> | ||
int main(void) | ||
{ | ||
int num=1000; | ||
int i,j,div; | ||
int x,y; | ||
|
||
x=clock(); | ||
for(i=2;i<=num;i++) | ||
{ | ||
for(div=2,j=1;(div*div)<i;div++) | ||
{ | ||
if(i%div==0) | ||
break; | ||
} | ||
if((div*div)>i) | ||
printf("%5d",i); | ||
} | ||
y=clock(); | ||
printf("�ܵļ���ʱ��Ϊ��%d",y-x); | ||
|
||
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,179 @@ | ||
#ifndef MZAE_H | ||
#define MAZE_H | ||
#include <stdio.h> | ||
#include <conio.h> | ||
#include <windows.h> | ||
|
||
/*���ļ��д�ͼ*/ | ||
void open(char *filename); | ||
|
||
/*��ӭ����*/ | ||
void hello(void); | ||
|
||
/*��ʾ��ͼ*/ | ||
void show_map(void); | ||
|
||
/*ʵ���ƶ�*/ | ||
void move(void); | ||
|
||
/*������ƶ�����ǰλ��*/ | ||
void gotoxy(int x, int y); | ||
|
||
/*���ع��*/ | ||
void HideCursor(void); | ||
|
||
char map[31][31] = { 0 }; | ||
|
||
void open(char *filename) { | ||
FILE *fp = fopen(filename, "r"); | ||
if (fp == NULL) { | ||
printf("File open error!"); | ||
return; | ||
} | ||
else { | ||
for (int i = 0;i < 31;i++) { | ||
for (int j = 0;j < 31;j++) { | ||
fscanf(fp, "%d", &map[i][j]); | ||
} | ||
} | ||
} | ||
return; | ||
} | ||
void hello(void) { | ||
system("mode con cols=30 lines=15"); | ||
system("cls"); | ||
printf("*** A LITTLE MAZE ***\n\n\n\n"); | ||
printf(" 1.play\n\n"); | ||
printf(" 2.quit\n\n\n\n\n"); | ||
printf("*** JUST FOR FUN ***\n\n"); | ||
HideCursor(); | ||
char option; | ||
option = getch(); | ||
if (option == '1') { | ||
move(); | ||
} | ||
else { | ||
system("cls"); | ||
gotoxy(15, 7); | ||
printf("Bye~"); | ||
return; | ||
} | ||
} | ||
|
||
void show_map(void) { | ||
int i, j; | ||
for (i = 0;i < 31;i++) { | ||
for (j = 0;j < 31;j++) { | ||
if (map[i][j] == 0) printf(" "); | ||
else if (map[i][j] == 1) printf("��"); | ||
else printf("��"); | ||
} | ||
printf(" \n"); | ||
} | ||
} | ||
|
||
void move(void) { | ||
system("mode con cols=85 lines=33"); | ||
system("cls"); | ||
|
||
int count = 0; | ||
int x = 29, y = 29; | ||
show_map(); | ||
|
||
char ch; | ||
do { | ||
ch = getch(); | ||
if (ch == -32) { | ||
switch (ch = getch()) { | ||
case 72:ch = 'w';break; | ||
case 80:ch = 's';break; | ||
case 75:ch = 'a';break; | ||
case 77:ch = 'd';break; | ||
default: | ||
printf("Oh!Wrong button!"); | ||
break; | ||
} | ||
} | ||
else { | ||
system("cls"); | ||
printf("Are you sure you want to quit?\n"); | ||
printf(" 1.yes 2.no\n"); | ||
if (getch() == '1') { | ||
printf("Bye~"); | ||
return; | ||
} | ||
else { | ||
system("cls"); | ||
show_map(); | ||
} | ||
} | ||
if (ch == 'w'&&map[x - 1][y] == 0) { | ||
map[x][y] = 0; | ||
gotoxy(2 * y, x); | ||
printf(" "); | ||
map[x--][y] = 1; | ||
gotoxy(2 * y, x); | ||
printf("��"); | ||
count++; | ||
} | ||
else if (ch == 's'&&map[x + 1][y] == 0) { | ||
map[x][y] = 0; | ||
gotoxy(2 * y, x); | ||
printf(" "); | ||
map[x++][y] = 1; | ||
gotoxy(2 * y, x); | ||
printf("��"); | ||
count++; | ||
} | ||
else if (ch == 'a'&&map[x][y - 1] == 0) { | ||
map[x][y] = 0; | ||
gotoxy(2 * y, x); | ||
printf(" "); | ||
map[x][y--] = 1; | ||
gotoxy(2 * y, x); | ||
printf("��"); | ||
count++; | ||
} | ||
else if (ch == 'd'&&map[x][y + 1] == 0) { | ||
map[x][y] = 0; | ||
gotoxy(2 * y, x); | ||
printf(" "); | ||
map[x][y++] = 1; | ||
gotoxy(2 * y, x); | ||
printf("��"); | ||
count++; | ||
} | ||
if (x == 29 && y == 30) { | ||
system("mode con cols=30 lines=15"); | ||
system("cls"); | ||
gotoxy(13, 6); | ||
printf("You win!"); | ||
return; | ||
} | ||
} while (1); | ||
} | ||
|
||
void gotoxy(int x, int y) { | ||
HANDLE hwnd; | ||
COORD coord; | ||
coord.X = x; | ||
coord.Y = y; | ||
hwnd = GetStdHandle(STD_OUTPUT_HANDLE); | ||
SetConsoleCursorPosition(hwnd, coord); | ||
HideCursor(); | ||
} | ||
|
||
void HideCursor(void)//����̵� | ||
{ | ||
CONSOLE_CURSOR_INFO cursor_info = { 1, 0 }; | ||
SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &cursor_info); | ||
} | ||
|
||
void refresh(int x, int y) { | ||
for (;y < 31;y++) { | ||
if (map[x][y] == 0)printf(" "); | ||
else if (map[x][y] == 1)printf("%c", 219); | ||
else printf("%c", 236); | ||
} | ||
} | ||
#endif |
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,19 @@ | ||
#include <stdio.h> | ||
/*todolist | ||
1.��ʾ��Ϸ������ | ||
2.��ʾ��ͼ | ||
3.��ʾ���λ�� | ||
4.��������ƶ� | ||
�� | ||
�� | ||
�� | ||
�� | ||
5.���µ�ͼ | ||
6.�˳����ǻ�� | ||
6.��ʾ���Ӯ����Ϸ | ||
*/ | ||
#include "maze.h" | ||
int main(void) { | ||
open("mazemap.txt"); | ||
hello(); | ||
} |
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 @@ | ||
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 | ||
1 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 | ||
1 1 1 1 1 0 1 0 1 0 1 0 1 1 1 1 1 0 1 0 1 1 1 0 1 1 1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 0 1 0 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 | ||
1 0 1 0 1 0 0 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 | ||
1 0 1 0 1 0 1 0 1 1 1 0 1 0 1 1 1 0 1 0 1 1 1 1 1 0 1 1 1 0 1 | ||
1 0 0 0 1 0 1 0 1 0 0 0 1 0 1 0 0 0 1 0 1 0 0 0 0 0 1 0 0 0 1 | ||
1 0 1 1 1 0 1 0 1 0 1 1 1 0 1 0 1 1 1 1 1 0 1 1 1 1 1 0 1 0 1 | ||
1 0 0 0 0 0 1 0 1 0 0 0 1 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 1 | ||
1 1 1 1 1 1 1 0 1 1 1 0 1 0 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 0 1 | ||
1 0 0 0 1 0 0 0 1 0 1 0 1 0 0 0 1 0 0 0 0 0 1 0 1 0 0 0 0 0 1 | ||
1 0 1 1 1 0 1 1 1 0 1 0 1 1 1 0 1 1 1 1 1 1 1 0 1 0 1 1 1 1 1 | ||
1 0 0 0 1 0 0 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 1 0 0 0 1 0 1 | ||
1 0 1 0 1 1 1 1 1 0 1 1 1 0 1 1 1 0 1 0 1 0 1 0 1 1 1 0 1 0 1 | ||
1 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 2 0 | ||
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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.
Smell!闻到了重复的味道!请设法消除它