-
Notifications
You must be signed in to change notification settings - Fork 33
提交 #24
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
base: master
Are you sure you want to change the base?
提交 #24
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| #include<stdio.h> | ||
| #include<windows.h> | ||
| #include<stdlib.h> | ||
| #define boundary 50; | ||
|
Owner
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. 多了分号
Author
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. 。。。ok
Owner
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. 多了分号;
Owner
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. 突然发现两个一样的文件?
Author
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. ....可能push的姿势不对 |
||
|
|
||
| void setCursor(int x, int y) | ||
|
Owner
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. 代码能编译过吗?
Author
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. 。。。。。还真的过了 |
||
|
|
||
|
Owner
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. 这种空行应该删掉
Owner
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. 去掉多余的空行;只有是代码看起来更清晰的空行才是“好”空行,空格同理 |
||
| { | ||
| HANDLE hCon = GetStdHandle(STD_OUTPUT_HANDLE); | ||
| COORD pos; | ||
| pos.X = x; | ||
| pos.Y = y; | ||
| SetConsoleCursorPosition(hCon,pos); | ||
|
|
||
| } | ||
|
|
||
|
|
||
|
|
||
| void setConsole() | ||
|
|
||
| { | ||
|
|
||
| HANDLE hCon = GetStdHandle(STD_OUTPUT_HANDLE); | ||
|
|
||
| SMALL_RECT rc; | ||
|
|
||
| rc.Left = 0; | ||
|
|
||
| rc.Top = 0; | ||
|
|
||
| rc.Right = boundary; | ||
|
|
||
| rc.Bottom = 29; | ||
|
|
||
| SetConsoleWindowInfo(hCon, TRUE, &rc); | ||
|
|
||
| } | ||
|
|
||
|
|
||
|
|
||
| void run() | ||
|
|
||
| { | ||
|
|
||
| setConsole(); | ||
| int x =0, y = 0; | ||
| int test = 1; | ||
| char value; | ||
| scanf("%c", &value); | ||
| setCursor(x, y); | ||
| printf("%c", value); | ||
| Sleep(70); | ||
| while (1) { | ||
| system("cls"); | ||
| if (test)/*换boundary蜜汁显示缺小括号*/ | ||
| setCursor(x++, y); | ||
| else | ||
| setCursor(--x, y); | ||
| if (x >= 50) | ||
| test = !test; | ||
| else if(x<0) | ||
| test = !test; | ||
|
|
||
| printf("%c", value); | ||
| Sleep(70); | ||
| } | ||
| } | ||
|
|
||
|
|
||
|
|
||
| int main() { | ||
|
|
||
| run(); | ||
| system("pause"); | ||
| return 0; | ||
|
|
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| #include<stdio.h> | ||
| #include<stdlib.h> | ||
| #include<math.h> | ||
| int main() { | ||
|
|
||
| int a, i, m; | ||
| scanf("%d", &a); | ||
| m = sqrt((double)a); | ||
| for (i = 2; i <= m; i++) | ||
| if (a%m == 0) | ||
| break; | ||
| else if (i <= m) | ||
| printf("No!this is not a prime."); | ||
| else | ||
| printf("Yes,it is a prime."); | ||
|
|
||
|
|
||
|
|
||
| system("pause"); | ||
| return 0; | ||
|
|
||
| } | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| #include <stdio.h> | ||
| #include<stdlib.h> | ||
| void main() | ||
| { | ||
| int i; | ||
| for (i = 1;i<300; i++) | ||
| { | ||
| if (i*1.0 / 6 + i*1.0 / 12 + i*1.0/ 7+ 5 + 4 == i*1.0/ 2) | ||
| { | ||
| printf("����ͼ��������%d��", i); | ||
| break; | ||
| } | ||
| } | ||
| system("pause"); | ||
| return 0; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| #include<stdio.h> | ||
| #include<math.h> | ||
| int main() { | ||
|
|
||
| int a, b, c,value; | ||
|
|
||
| printf("����������"); | ||
|
|
||
| for (int i = 2; i < =1000; i++) { | ||
| a = sqrt(i); | ||
| if (i%a!= 0) { | ||
| printf("%d\n", i); | ||
| } | ||
|
|
||
| } | ||
|
|
||
|
|
||
|
|
||
| system("pause"); | ||
| return 0; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| #include<stdio.h> | ||
| int prime(int n) | ||
| { | ||
| for (int i = 2; i*i <= n; i++) //����� | ||
| if (n%i == 0)return 0; | ||
| return n > 1; | ||
| } | ||
| int main() | ||
| { | ||
| int x, i; | ||
| printf("������1~100������:"); | ||
| scanf("%d", &x); //��������� | ||
| for (i = 2; i <= x / 2; i++) //�����ظ� | ||
| if (prime(i) && prime(x - i)) | ||
| { | ||
| printf("%d=%d+%d\n", x, x - i, i); | ||
| getchar(); | ||
| return 0; | ||
|
|
||
| } | ||
|
|
||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,105 @@ | ||
| #include<stdio.h> | ||
| #include<string.h> | ||
| #include<string.h> | ||
| int main() { | ||
|
|
||
| int i, j, k, num, num1; | ||
| char a1[30], a2[30]; | ||
| printf("��ѡ������:\n1.����\t 2.����\n"); | ||
| scanf("%d", &num); | ||
| if (num = 1) { | ||
|
|
||
| printf("����������ı�:"); | ||
| int num1 = 0; | ||
| int len; | ||
| scanf("%d",&a1); | ||
| len = strlen(a1); | ||
| printf("�����ƶ�λ��:"); | ||
| scanf("%d", num1); | ||
| for (i = 0; i < len; i++) { | ||
| if (a1[i] >= 'A'&&a1[i] <= 'Z') | ||
| { | ||
| a1[i] = (a1[i] - 'A' + num1) % 26 + 'A'; | ||
| } | ||
| else if (a1[i] >= 'a'&&a1[i] <= 'z') | ||
| { | ||
| a1[i] = (a1[i] - 'a' + num1) % 26 + 'a'; | ||
| } | ||
|
|
||
| } | ||
| printf("������ܽ��:%c", a1); | ||
| printf("\n"); | ||
| } | ||
| if (num = 2) { | ||
| printf("����������ı�:"); | ||
| int len,num1; | ||
| scanf("%d", &a1); | ||
| len = strlen(a1); | ||
| for (num1 = 0; num1 < 26;num1++) { | ||
| for (i = 0; i < len; i++) { | ||
| if (a1[i] >= 'A'&&a1[i] <= 'Z') | ||
| { | ||
| a1[i] = (a1[i] - 'A' + num1) % 26 + 'A'; | ||
| } | ||
| else if (a1[i] >= 'a'&&a1[i] <= 'z') | ||
| { | ||
| a1[i] = (a1[i] - 'a' + num1) % 26 + 'a'; | ||
| } | ||
|
|
||
| } | ||
| printf("������ܽ��:%c",a1); | ||
| system("pause"); | ||
| printf("\n"); | ||
|
|
||
| } | ||
| } | ||
| getchar(); | ||
| return 0; | ||
| } | ||
|
|
||
| #define MAX 30 | ||
| /*int main() { | ||
| char P[MAX] = { 0 }; | ||
| printf("������������ı�:"); | ||
| scanf("%d", &P); | ||
| int len, i, j, k, temp,num = 0; | ||
| len = strlen(P); | ||
| int A1[1][MAX] = { 0 }, A2[1][MAX] = { 0 }; | ||
| int t1[MAX] = { 0 }, t2[MAX] = { 0 }; | ||
| printf("�������ܳ�:\n"); | ||
| for (i = 0; i < len; i++) { | ||
| for (j = 0; j < len; j++) { | ||
| scanf("%d", &A1[i][j]); | ||
| printf("�ܳ�Ϊ:%s", A1); | ||
| } | ||
| } | ||
|
|
||
| printf("��ѡ������:\n1.����\t 2.����\n"); | ||
| scanf("%d", &num); | ||
| if (num = 1) { | ||
| for (i = 0; i < len; i++) { | ||
| if (P[i] >= 'A'&&P[i] <= 'Z') { | ||
| P[i] = P[i] +32; | ||
| t1[i] = P[i] - 'a'; | ||
| } | ||
| } | ||
| for (i = 0; i < len; i++) { | ||
| for (j = 0; j < len; j++) { | ||
| temp = 0; | ||
| for (k = 0; k < len; k++) { | ||
| temp+= t1[k] * A1[k][j]; | ||
| } | ||
| A2[i][j] = temp; | ||
| printf("%d\t", A2[i][j]); | ||
| } | ||
| printf("%d\n"); | ||
| } | ||
| printf("%d", A2); | ||
| for (i = 0; i < len; i++) { | ||
| t2[i] = A2[i] + 'a'; | ||
| } | ||
| printf("���ܽ��Ϊ:%d", t2[i]); | ||
| system("pause"); | ||
| } | ||
| return 0; | ||
| }*/ //emmmmm��debug |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| #include<stdio.h> | ||
| void hano(int n,char p1, char p2, char p3) { | ||
| if (n == 1) { | ||
| printf("\t%c-->%c", p1, p3); | ||
| } | ||
| else | ||
| { | ||
| hano(n - 1, p1, p3, p2); | ||
| printf("\t%c-->%c\n", p1, p3); | ||
| hano(n - 1, p2, p1, p3); | ||
| } | ||
| } | ||
| int main() { | ||
| int n; | ||
| printf("�����ƶ�����:"); | ||
| scanf("%d", &n); | ||
| hano(n, 'p1', 'p2','p3'); | ||
| return 0; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| #include<stdio.h> | ||
| #include<malloc.h> | ||
| int* ptr = NULL; | ||
| static int count = 0; | ||
| void insert(data){ | ||
| if (ptr == NULL) { | ||
| ptr = (int*)malloc(sizeof(int)); | ||
| ptr[0] = data; | ||
| } | ||
| else { | ||
| ptr = (int*)realloc(ptr, sizeof(int)*(count + 1)); | ||
| ptr[count] = data; | ||
| } | ||
| count++; | ||
| } | ||
| void show() { | ||
| int i = 0; | ||
| for (i = 0; i < count; i++) { | ||
| printf("%d\n", ptr[i]); | ||
| } | ||
| } | ||
| int main(int argc, char*argv[]) { | ||
| int c = 0; | ||
| int data; | ||
| while (1) | ||
| { | ||
| printf("choice"); | ||
| printf("1 is to insert data\n"); | ||
| printf("2 is to show data.\n"); | ||
| printf("3 is to quit\n "); | ||
| scanf("%d\n", &c); | ||
| switch (c) { | ||
| case 1: | ||
| printf("date="); | ||
| scanf("%d\n", &data); | ||
| insert(data); | ||
| break; | ||
| case 2: | ||
| show(); | ||
| break; | ||
| case 3: | ||
| exit(0); | ||
| } | ||
| } | ||
| return 0; | ||
| getchar(); | ||
| } | ||
| //����2��emmm���� |
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.
不能使用中文文件名
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.
ojbk