会员
周边
新闻
博问
闪存
赞助商
YouClaw
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
myrj
博客园
首页
新随笔
联系
订阅
管理
上一页
1
···
141
142
143
144
145
146
147
148
149
···
188
下一页
2021年6月18日
C语言:逻辑运算符||
摘要: #include <stdio.h> //逻辑运算符||特点:左右两边的表达式先做左边,如果左边为1则右边不用执行,整个结果为1;如果左边为0,再执行右边; main() { int x=1,y=1,a,b; a= y-- || x--;//根据优先级先做y--(式子结果为1,y的值为0); //根
阅读全文
posted @ 2021-06-18 05:45 myrj
阅读(258)
评论(0)
推荐(0)
2021年6月17日
c语言:枚举类型
摘要: 枚举类型的定义形式为:enum typeName{ valueName1, valueName2, valueName3, ...... }; enum是一个新的关键字,专门用来定义枚举类型,这也是它在C语言中的唯一用途;typeName是枚举类型的名字;valueName1, valueName2
阅读全文
posted @ 2021-06-17 19:49 myrj
阅读(501)
评论(0)
推荐(0)
c语言:随机函数应用
摘要: #include <stdio.h> #include <time.h>//声明time 时间不可逆转一直在变 #include <math.h> #include <stdlib.h> //<stdlib.h>用于调用 rand(), main() { srand((unsigned)time(0
阅读全文
posted @ 2021-06-17 07:05 myrj
阅读(156)
评论(0)
推荐(0)
2021年6月16日
C语言:随机抽奖
摘要: #include <stdio.h> #include <stdlib.h> //<stdlib.h>用于调用 rand(), #include <time.h> //声明time 时间不可逆转一直在变 #include <Windows.h> //<Windows.h> 用于清屏 #include
阅读全文
posted @ 2021-06-16 07:21 myrj
阅读(528)
评论(0)
推荐(0)
2021年6月15日
C语言:地址
摘要: 一切都是地址 C语言用变量来存储数据,用函数来定义一段可以重复使用的代码,它们最终都要放到内存中才能供 CPU 使用。数据和代码都以二进制的形式存储在内存中,计算机无法从格式上区分某块内存到底存储的是数据还是代码。当程序被加载到内存后,操作系统会给不同的内存块指定不同的权限,拥有读取和执行权限的内存
阅读全文
posted @ 2021-06-15 15:06 myrj
阅读(872)
评论(0)
推荐(1)
C语言:类型转换
摘要: 1.自动类型转换:将小范围数据类型转换为大范围的数据类型 2.赋值号两边的数据类型不一致时,会自动将右边的数据类型转换为左边的数据类型。若右边数据的类型级别高,则根据左边变量的长度截取低字节数据部分 int a=259;char b;b=a;//(a=259-256=3) int a=266;cha
阅读全文
posted @ 2021-06-15 09:37 myrj
阅读(379)
评论(0)
推荐(0)
C语言:交换两个变量的值
摘要: #include <stdio.h> int main() { int a,b; //方法一:借助第三个变量 int t; a=1,b=2; t=a; a=b; b=t; printf("%d,%d\n",a,b); //方法二 :先保存两数之和 a=1,b=2; a=a+b; b=a-b; a=a
阅读全文
posted @ 2021-06-15 08:35 myrj
阅读(768)
评论(0)
推荐(0)
C语言:3个数排序
摘要: #include <stdio.h> int main() { int a,b,c,t; /*定义4个基本整型变量a、b、c、t*/ printf("Please input a,b,c:\n"); /*双引号内的普通字符原样输出并换行*/ scanf("%d,%d,%d",&a,&b,&c); /
阅读全文
posted @ 2021-06-15 06:29 myrj
阅读(677)
评论(0)
推荐(0)
2021年6月14日
C语言:最大公约数和最小公倍数
摘要: #include <stdio.h> int main() { int a,b,c,m,t; printf("请输入两个数:\n"); scanf("%d%d",&a,&b); if(a<b) { t=a; a=b; b=t; } m=a*b; c=a%b; while(c!=0) { a=b; b
阅读全文
posted @ 2021-06-14 10:24 myrj
阅读(238)
评论(0)
推荐(0)
C语言:统计字符个数及种类
摘要: #include <stdio.h> int main(){ char c; //用户输入的字符 int shu=0;//字符总数 int letters=0, // 字母数目 space=0, // 空格数目 digit=0, // 整数数目 others=0; // 其他字符数目 printf(
阅读全文
posted @ 2021-06-14 09:35 myrj
阅读(2627)
评论(0)
推荐(0)
上一页
1
···
141
142
143
144
145
146
147
148
149
···
188
下一页
公告