密码三次就会锁掉 while 循环
摘要:while 只要给定的条件为真,C 语言中的 while 循环语句会重复执行一个目标语句 一般定义 //return_type function_name( parameter list ) //{ // body of the function //} 在 C 语言中,函数由一个函数头和一个函数主
阅读全文
posted @
2021-07-28 12:12
Bytezero!
阅读(317)
推荐(0) 编辑
100的累加和 for循环
摘要:1 int main() 2 { 3 int sum ; 4 int i; 5 for(i = 0; i<101; i++) 6 { 7 sum += i; 8 } 9 printf("100的累加和为:%d",sum); //5050 10 }
阅读全文
posted @
2021-07-28 12:10
Bytezero!
阅读(294)
推荐(0) 编辑
取个位数
摘要:1 #include <stdio.h> 2 int main() 3 { 4 5 int num = 123456; 6 while(num>0) 7 { 8 9 10 printf("%d\n",num % 10); 11 num=num/10; //去掉取掉的最后一位 12 }
阅读全文
posted @
2021-07-28 12:09
Bytezero!
阅读(102)
推荐(0) 编辑
求6个月的平均工资
摘要:1 #include <stdio.h> 2 int main () 3 { 4 double salary ; //工资 5 double total_salary = 0; 6 double adv_salary; 7 int i ; 8 for(i = 0;i < 6;i++) 9 { 10
阅读全文
posted @
2021-07-28 12:07
Bytezero!
阅读(111)
推荐(0) 编辑
输入一个数字,找出整数相加都等于输入的数字
摘要:1 //输入一个数字,找出整数相加都等于输入的数字 2 3 4 #include <stdio.h> 5 int main() 6 { 7 int num ; 8 int i ; 9 printf("请输入一个数字: "); //6 10 scanf("%d",&num); 11 12 for( i
阅读全文
posted @
2021-07-28 12:04
Bytezero!
阅读(84)
推荐(0) 编辑
用 区间判断(if)来猜价格的高低
摘要:1 #include <stdio.h> 2 #include <stdlib.h> 3 int main() 4 { 5 int price = 150; 6 int guess ; 7 int i = 0; 8 9 10 for(;i<5 ;i++) 11 { 12 13 printf("请输入
阅读全文
posted @
2021-07-28 12:02
Bytezero!
阅读(193)
推荐(0) 编辑
1-100之间的偶数和
摘要:#include<stdio.h> int main() { int i =1; int sum = 0; for(i = 0; i <101; i++) { if( i % 2 == 0) { sum += i; } } printf("%d\n",sum); }
阅读全文
posted @
2021-07-28 12:00
Bytezero!
阅读(510)
推荐(0) 编辑
C语言数组
摘要:C 语言支持数组数据结构,它可以存储一个固定大小的相同类型元素的顺序集合。数组是用来存储一系列数据,但它往往被认为是一系列相同类型的变量。 数组的声明并不是声明一个个单独的变量,比如 runoob0、runoob1、...、runoob99,而是声明一个数组变量,比如 runoob,然后使用 run
阅读全文
posted @
2021-07-28 11:57
Bytezero!
阅读(108)
推荐(0) 编辑
数组 累加 查找
摘要:1 #include <stdio.h> 2 int main() 3 { 4 int nums[] = {8,4,2,1,23,344,12}; 5 int i; 6 int sum = 0; 7 double avg; 8 9 int searchNum; 10 11 //打印 数组里的元素 1
阅读全文
posted @
2021-07-28 11:55
Bytezero!
阅读(68)
推荐(0) 编辑
数组 动态录入
摘要:1 //动态录入 2 3 #include <stdio.h> 4 # define N 5 5 int main() 6 { 7 8 double score[5]; //数组5 个元素 9 int i; // 循环变量 10 for(i = 0; i < N; i++) 11 { 12 prin
阅读全文
posted @
2021-07-28 11:54
Bytezero!
阅读(78)
推荐(0) 编辑
数组中的元素降序排列
摘要:1 #include <stdio.h> 2 #define N 7 3 4 int main() 5 { 6 7 int nums [N] = {10,85,96,5,9,6,200}; //定义了一个数组,里面有 7 个元素 8 int i ,j; 9 int temp; 10 11 //外层循
阅读全文
posted @
2021-07-28 11:50
Bytezero!
阅读(513)
推荐(0) 编辑
数组 查询 增加 删除 排序
摘要:1 //数组 查询 增加 删除 排序 2 3 #include <stdio.h> 4 int main() 5 { 6 7 double power[] = {100,855,600,8960,20}; //定义一个战斗力的数组 8 int count = 5; //元素个数为5 9 10 dou
阅读全文
posted @
2021-07-28 11:49
Bytezero!
阅读(49)
推荐(0) 编辑
二维数组
摘要:1 #include<stdio.h> 2 int main() 3 { 4 //使用二维数组 进行的打印 5 double scores[4][3] = {{87,56,89},{98,55,46},{98,65,56},{98,65,23}}; 6 int i,j; 7 for(i = 0; i
阅读全文
posted @
2021-07-28 11:45
Bytezero!
阅读(32)
推荐(0) 编辑
C 皇帝选妃游戏 结合所学
摘要:1 //皇帝游戏 2 3 //EmperroGame 4 #include <stdio.h> 5 #include <windows.h> 6 #include <mmsystem.h> 7 #include <stdlib.h> 8 #include <string.h> 9 #include
阅读全文
posted @
2021-07-28 11:40
Bytezero!
阅读(185)
推荐(0) 编辑
C指针
摘要:学习 C 语言的指针既简单又有趣。通过指针,可以简化一些 C 编程任务的执行,还有一些任务,如动态内存分配,没有指针是无法执行的。所以,想要成为一名优秀的 C 程序员,学习指针是很有必要的。 正如您所知道的,每一个变量都有一个内存位置,每一个内存位置都定义了可使用 & 运算符访问的地址,它表示了在内
阅读全文
posted @
2021-07-28 11:38
Bytezero!
阅读(47)
推荐(0) 编辑
指针 打印
摘要:1 //指针 2 3 4 5 #include <stdio.h> 6 int main() 7 { 8 int num = 9; 9 int *ptr_num1 = # 10 11 //int *ptr_num2 = &ptr_num; //指针的地址 12 int **ptr_num2
阅读全文
posted @
2021-07-28 11:30
Bytezero!
阅读(156)
推荐(0) 编辑
指针的操作
摘要:1 #include <stdio.h> 2 int main() 3 { 4 int num1 = 1024; 5 int num2 = 2048; 6 int *ptr1; 7 int *ptr2; 8 9 ptr1 = &num1; 10 ptr2 = &num2; 11 printf("nu
阅读全文
posted @
2021-07-28 11:25
Bytezero!
阅读(61)
推荐(0) 编辑
打印数组的元素
摘要:1 //打印数组的元素 2 3 4 #include <stdio.h> 5 int main() 6 { 7 8 //数组名就是数组的首地址 9 // double score[] = {69,43,56,48,52}; 10 // printf("数组的首地址:%p\t数组的首元素地址:%p\t
阅读全文
posted @
2021-07-28 11:20
Bytezero!
阅读(495)
推荐(0) 编辑
指针的 --
摘要:1 指针的 -- 2 3 #include <stdio.h> 4 int main() 5 { 6 int i; 7 double score[5] = {10,20,32,40,50}; 8 double *ptr_score; 9 ptr_score = &score[1]; // 20 10
阅读全文
posted @
2021-07-28 11:15
Bytezero!
阅读(35)
推荐(0) 编辑
指针的打印方式
摘要:1 #include <stdio.h> 2 void main() 3 { 4 int array[]={20,30,40,50,60}; 5 //int *ptr_array; 6 int *ptr_array = array; 7 int i; 8 for(i = 0; i <5;i++) 9
阅读全文
posted @
2021-07-28 11:10
Bytezero!
阅读(625)
推荐(0) 编辑