Skip to content

Commit

Permalink
commit 01_C语言程序设计
Browse files Browse the repository at this point in the history
  • Loading branch information
mox-hub committed Jan 26, 2022
1 parent 8072763 commit 4869b8c
Show file tree
Hide file tree
Showing 111 changed files with 9,226 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.exe
1 change: 1 addition & 0 deletions term1/01_C语言程序设计/编程作业/work01/001.c
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

12 changes: 12 additions & 0 deletions term1/01_C语言程序设计/编程作业/work01/0101.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/* example1-1*/
#include<stdio.h>

int main(void)
{
printf("hello world!");

return 0;
}



12 changes: 12 additions & 0 deletions term1/01_C语言程序设计/编程作业/work01/0102.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/* example1-2 */
#include<stdio.h>

int main(void)
{
printf(" *\n");
printf(" ***\n");
printf(" *****\n");
printf("*******\n");

return 0;
}
15 changes: 15 additions & 0 deletions term1/01_C语言程序设计/编程作业/work01/0103.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/* example103 */
#include<stdio.h>

int main(void)
{
int data1,data2,data3;

data1 = 80;
data2 = 80;
data3 = data1 + data2;

printf("data3 = %d\n",data3);

return 0;
}
23 changes: 23 additions & 0 deletions term1/01_C语言程序设计/编程作业/work01/0104.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/* example1-4 */
#include<stdio.h>

int main(void)
{
int a,b,y1,y2,y3,y4;;

a=12;
b=35;
y1 = a + b;
y2 = a - b;
y3 = a * b;
y4 = a / b;

printf("y1 = %d\n", y1);
printf("y2 = %d\n", y2);
printf("y3 = %d\n", y3);
printf("y4 = %d\n", y4);

return 0;
}


22 changes: 22 additions & 0 deletions term1/01_C语言程序设计/编程作业/work01/0105.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/* example1-5 */
#include<stdio.h>

int main(void)
{
char a, b, c, d;

printf("please enter a character: ");
scanf("%c",&c);
a = 'A';
b = a + 32;
d = 112;

printf("a = %c, %d\n", a, a);
printf("b = %c, %d\n", b, b);
printf("c = %c, %d\n", c, c);
printf("d = %c, %d\n", d, d);

return 0;


}
13 changes: 13 additions & 0 deletions term1/01_C语言程序设计/编程作业/work01/0106.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/* example1-6 */
#include<stdio.h>

int main(void)
{
int a = 9, b = 5;

printf("%d, %d\n", a, b);
printf("%d, %d\n", a++, b--);
printf("%d, %d\n", ++a, --b);

return 0;
}
15 changes: 15 additions & 0 deletions term1/01_C语言程序设计/编程作业/work01/0107.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/* example1-7 */
#include<stdio.h>

int main(void)
{
int a = -1;
unsigned b = 1;
char c = 'A';

printf("a = %u, %d, %o, %x\n", a, a, a, a);
printf("b = %u, %d, %o, %x\n", b, b, b, b);
printf("c = %u, %d, %o, %x\n", c, c, c, c);

return 0;
}
18 changes: 18 additions & 0 deletions term1/01_C语言程序设计/编程作业/work01/0108.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/* example1-8 */
#include<stdio.h>

int main(void)
{
int a, b, c, d, e, f;

a = sizeof(int);
b = sizeof(char);
c = sizeof(double);
d = sizeof(short);
e = sizeof(long);
f = sizeof(float);

printf("%d\n%d\n%d\n%d\n%d\n%d", a, b, c, d, e, f);

return 0;
}
25 changes: 25 additions & 0 deletions term1/01_C语言程序设计/编程作业/work01/0109.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/* example1-9 */
#include<stdio.h>
#include<math.h>

int main(void)
{
float x, y, dDistance, dAngle;

printf("ÇëÊäÈëxµÄÖµ:");
scanf("%f", &x);
printf("ÇëÊäÈëyµÄÖµ:");
scanf("%f", &y);

dDistance = sqrt((x * x)+(y * y));
dAngle = atan(y / x);

printf("The Distance is:%f\n", dDistance);
printf("The Angle is:%f rad\n", dAngle);

return 0;
}




22 changes: 22 additions & 0 deletions term1/01_C语言程序设计/编程作业/work01/0110.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/* example1-10 */
#include<stdio.h>
#include<math.h>
#define PI 3.1415

int main(void)
{
float r, fArea;
printf("请输入半径:");
scanf("%f", &r);

fArea = PI * r * r;

printf("圆的面积为:%f", fArea);

return 0;
}





17 changes: 17 additions & 0 deletions term1/01_C语言程序设计/编程作业/work01/Demo.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/* */
#include<stdio.h>

int main(void)
{

}










Binary file not shown.
21 changes: 21 additions & 0 deletions term1/01_C语言程序设计/编程作业/work02/0201.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//***********************************************
//File name:0201
//Author:ŔîşĆČť
//Date:2019.10.20
//Student ID:2019218211
//***********************************************
#include<stdio.h>
#include<math.h>

int main(void)
{
float a, b, c, q, fArea;
printf("please input triangles side:\n");
scanf("%f%f%f", &a, &b, &c);

q = (a + b + c) *0.5;
fArea = sqrt(q * (q - a) * (q - b) * (q - c));

printf("The area is:%.2f", fArea);

}
20 changes: 20 additions & 0 deletions term1/01_C语言程序设计/编程作业/work02/0202.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//***********************************************
//File name:0202
//Author:ÀîºÆÈ»
//Date:2019.10.20
//Student ID:2019218211
//***********************************************
#include<stdio.h>

int main(void)
{
float a, b, c, fVolume;
printf("Please input long,weight,high:\n");
scanf("%f%f%f", &a, &b, &c);

fVolume = a * b * c;

printf("The volume is:%.2f", fVolume);

return 0;
}
20 changes: 20 additions & 0 deletions term1/01_C语言程序设计/编程作业/work02/0203.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//***********************************************
//File name:0203
//Author:ÀîºÆÈ»
//Date:2019.10.20
//Student ID:2019218211
//***********************************************
#include<stdio.h>
#define PI 3.14159
int main(void)
{
float r, h, fVolume;
printf("please input r,h:\n");
scanf("%f%f", &r, &h);

fVolume = (PI * r * r * h)/3;

printf("The volume is:%f", fVolume);

return 0;
}
21 changes: 21 additions & 0 deletions term1/01_C语言程序设计/编程作业/work02/0204.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//***********************************************
//File name:0204
//Author:李浩然
//Date:2019.10.20
//Student ID:2019218211
//***********************************************
#include<stdio.h>
#define PI 3.14159

int main(void)
{
float fAngle, r, fArea;
printf("请输入度数和半径:");
scanf("%f%f", &fAngle, &r);

fArea = (fAngle / 360) * PI * r * r;

printf("扇形的面积是:%f", fArea);

return 0;
}
29 changes: 29 additions & 0 deletions term1/01_C语言程序设计/编程作业/work02/0205.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//***********************************************
//File name:0205
//Author:李浩然
//Date:2019.10.20
//Student ID:2019218211
//***********************************************
#include<stdio.h>
#include<math.h>

int main(void)
{
float x, y, z, fDistance;
float a, b, c;
printf("请输入x,y,z:");
scanf("%f%f%f", &x, &y, &z);

fDistance = sqrt(x * x + y * y + z * z);
a = acos(x/fDistance);
b = acos(y/fDistance);
c = acos(z/fDistance);

printf("到原点的距离 = %f", fDistance);
printf("与x轴的夹角= %f", a);
printf("与y轴的夹角= %f", b);
printf("与z轴的夹角= %f", c);

return 0;
}

20 changes: 20 additions & 0 deletions term1/01_C语言程序设计/编程作业/work02/0206.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//***********************************************
//File name:0206
//Author:李浩然
//Date:2019.10.20
//Student ID:2019218211
//***********************************************
#include<stdio.h>

int main(void)
{
float a, b, c, d, fAverange;
printf("请输入四科成绩:\n");
scanf("%f%f%f%f", &a, &b, &c, &d);

fAverange = (a + b + c + d)/4;

printf("四科成绩的平均值是:%.2f", fAverange);

return 0;
}
18 changes: 18 additions & 0 deletions term1/01_C语言程序设计/编程作业/work02/0207.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//***********************************************
//File name:0207
//Author:李浩然
//Date:2019.10.20
//Student ID:2019218211
//***********************************************
#include<stdio.h>

int main(void)
{
int a;
printf("请输入0~9中的任意一位数字:");
scanf("%d", &a);
a = a + 32;
printf("它对应的ASCII码是:%d", a);

return 0;
}
20 changes: 20 additions & 0 deletions term1/01_C语言程序设计/编程作业/work02/0208.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//***********************************************
//File name:0208
//Author:李浩然
//Date:2019.10.20
//Student ID:2019218211
//***********************************************
#include<stdio.h>

int main(void)
{
char a, b;
printf("请输入大写字母:");
scanf("%c", &a);

b = a + 32;

printf("它的小写字母是:%c\n", b);

return 0;
}
Loading

0 comments on commit 4869b8c

Please sign in to comment.