C 购买商品的游戏
摘要:1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <string.h> 4 /* 5 *模拟实现道具店购物功能(商店暂时只支持一种类型的商品) 6 *商品具备名称,价格,库存等属性 7 *模拟玩家购买游戏道具 8 *1.玩家选择要购买的道具
阅读全文
posted @
2021-07-30 12:45
Bytezero!
阅读(146)
推荐(0) 编辑
密码三次就会锁掉 while 循环
摘要:while 只要给定的条件为真,C 语言中的 while 循环语句会重复执行一个目标语句 一般定义 //return_type function_name( parameter list ) //{ // body of the function //} 在 C 语言中,函数由一个函数头和一个函数主
阅读全文
posted @
2021-07-28 12:12
Bytezero!
阅读(316)
推荐(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!
阅读(110)
推荐(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!
阅读(192)
推荐(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!
阅读(509)
推荐(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) 编辑
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) 编辑
指针的打印方式
摘要: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) 编辑
数字转换大写的中文
摘要:1 #include <stdio.h> 2 int main() 3 { 4 5 int moneys[6]; 6 char unit[10][4] ={"零","壹","贰","叁","肆","伍","陆","柒","捌","玖"}; 7 int i =0; 8 int money,count
阅读全文
posted @
2021-07-28 11:00
Bytezero!
阅读(53)
推荐(0) 编辑
C中的内置函数
摘要:1 //#include <stdio.h> 2 //#include <ctype.h> 3 //#include <math.h> 4 //#include <stdlib.h> 5 //#include <time.h> 6 7 //int main() 8 //{ 9 10 /* 11 //
阅读全文
posted @
2021-07-28 10:55
Bytezero!
阅读(156)
推荐(0) 编辑
函数查找
摘要:1 #include <stdio.h> 2 #include <stdlib.h> 3 4 5 6 int search(); 7 8 9 int main() 10 { 11 12 13 int index = search(); 14 printf("找到的元素的下标是:%d\n",index
阅读全文
posted @
2021-07-28 10:45
Bytezero!
阅读(37)
推荐(0) 编辑
C函数调用(2)
摘要:1 //函数调用 2 3 #include <stdio.h> 4 #include <stdlib.h> 5 #include <math.h> 6 //根据传入的半径,返回圆的面积 7 double calcCircle(double); 8 9 //要对用户输入进行非负的判断 10 int v
阅读全文
posted @
2021-07-28 10:35
Bytezero!
阅读(34)
推荐(0) 编辑
C作用域
摘要:任何一种编程中,作用域是程序中定义的变量所存在的区域,超过该区域变量就不能被访问。C 语言中有三个地方可以声明变量: 在函数或块内部的局部变量 在所有函数外部的全局变量 在形式参数的函数参数定义中 局部变量 在某个函数或块的内部声明的变量称为局部变量。它们只能被该函数或该代码块内部的语句使用。局部变
阅读全文
posted @
2021-07-28 10:05
Bytezero!
阅读(151)
推荐(0) 编辑
书写一个小型的学生成绩管理系统
摘要:1 //书写一个小型的学生成绩管理系统 2 3 #include <stdio.h> 4 #include <stdlib.h> 5 #define N 5 6 //书写一个小型的学生成绩管理系统 7 void input(double []); 8 void sort(double []); 9
阅读全文
posted @
2021-07-28 09:50
Bytezero!
阅读(91)
推荐(0) 编辑
返回传入字符串的长度
摘要:1 #include<stdio.h> 2 #include<stdlib.h> 3 #include<string.h> 4 5 //返回传入字符串的长度 6 int GetStrLength(char[]); 7 8 //封装fgets<用来接收字符串的字符数组,接收的字符总数 9 void G
阅读全文
posted @
2021-07-28 09:32
Bytezero!
阅读(137)
推荐(0) 编辑
内置函数 strlen
摘要:1 //内置函数 strlen 2 //计算字符串的实际长度,不含字符串结束标准\0 3 4 #include<stdio.h> 5 #include<stdlib.h> 6 #include<string.h> 7 8 void main() 9 { 10 11 char words1[] = {
阅读全文
posted @
2021-07-28 09:30
Bytezero!
阅读(57)
推荐(0) 编辑
内置函数 字符串的复制 strcpy
摘要:1 #include<stdio.h> 2 #include<stdlib.h> 3 #include<string.h> 4 5 6 void main() 7 { 8 9 char str1[50]; 10 char str2[20]; 11 printf("输入目的字符串:"); 12 get
阅读全文
posted @
2021-07-28 09:25
Bytezero!
阅读(49)
推荐(0) 编辑
内置函数 字符串比较 strcmp 登录密码
摘要:1 //内置函数 字符串比较 strcmp 2 // 原理:将两个字符串从首字母开始,按照ASCII码的顺序逐个比较 3 //字符串1 == 字符串2 返回0 4 //字符串1 < 字符串2, 返回正数 5 //字符串1 > 字符串2 ,返回负数 6 7 #include<stdio.h> 8 #i
阅读全文
posted @
2021-07-28 09:20
Bytezero!
阅读(149)
推荐(0) 编辑
字符串连接 strcat
摘要:1 //字符串连接 strcat 2 //将一个字符串连接到另一个字符串的末尾,组合成一个新字符串 3 4 #include<stdio.h> 5 #include<stdlib.h> 6 #include<string.h> 7 8 void main() 9 { 10 char str1[200
阅读全文
posted @
2021-07-28 09:10
Bytezero!
阅读(127)
推荐(0) 编辑