随笔分类 -  c/c++

上一页 1 2 3 4 5 6 7 ··· 30 下一页
摘要:001、c语言中条件运算符 [root@localhost test]# cat test.c ## 测试程序 #include <stdio.h> int main(void) { int n1, n2, max; puts("please input two integers"); printf 阅读全文
posted @ 2024-09-03 12:59 小鲨鱼2018 阅读(15) 评论(0) 推荐(0) 编辑
摘要:001、 [root@PC1 test]# ls test.c [root@PC1 test]# cat test.c #include <stdio.h> int main(void) { double i; //声明double型 和 float型变量 float j; i = 3.14; j 阅读全文
posted @ 2024-08-19 23:35 小鲨鱼2018 阅读(54) 评论(0) 推荐(0) 编辑
摘要:001、a、%lf、和 %f读入double型值 [root@PC1 test]# ls test.c [root@PC1 test]# cat test.c ## 测试程序 #include <stdio.h> int main(void) { double i, j; // 声明两个double 阅读全文
posted @ 2024-08-19 22:51 小鲨鱼2018 阅读(70) 评论(0) 推荐(0) 编辑
摘要:001、 测试%lf输出double型和int型变量的差异 [root@PC1 test]# ls test.c [root@PC1 test]# cat test.c ## 测试c程序 #include <stdio.h> int main(void) { double i; /*声明doble型 阅读全文
posted @ 2024-08-19 21:54 小鲨鱼2018 阅读(37) 评论(0) 推荐(0) 编辑
摘要:001、读入整型数据 [root@PC1 test]# ls test.c [root@PC1 test]# cat test.c ## 测试脚本 #include <stdio.h> int main(void) { int i; //声明整型变量 puts("please input an in 阅读全文
posted @ 2024-08-19 21:37 小鲨鱼2018 阅读(80) 评论(0) 推荐(0) 编辑
摘要:001、整型格式化输出浮点型 [root@PC1 test]# ls test.c [root@PC1 test]# cat test.c #include <stdio.h> int main(void) { double i; //定义浮点型变量 i = 5.8; printf("i = %d\ 阅读全文
posted @ 2024-08-14 10:58 小鲨鱼2018 阅读(36) 评论(0) 推荐(0) 编辑
摘要:001、在linux中如果程序正常执行,则返回0,错误执行返回非0值 [root@PC1 test]# ls a.txt [root@PC1 test]# cat a.txt sf ab 35 34543 [root@PC1 test]# grep "a" a.txt ab [root@PC1 te 阅读全文
posted @ 2024-07-30 14:49 小鲨鱼2018 阅读(19) 评论(0) 推荐(0) 编辑
摘要:001、输出整型数据,直接输出 [root@PC1 test]# ls test.c [root@PC1 test]# cat test.c #include <stdio.h> int main(void) { printf("[%d]\n", 123); return 0; } [root@PC 阅读全文
posted @ 2024-07-29 19:02 小鲨鱼2018 阅读(50) 评论(0) 推荐(0) 编辑
摘要:001、 测试 [root@PC1 test]# ls test.c [root@PC1 test]# cat test.c #include <stdio.h> int main(void) { int i = 10; double j = 5.8; printf("i + j = %f\n", 阅读全文
posted @ 2024-07-29 09:01 小鲨鱼2018 阅读(64) 评论(0) 推荐(0) 编辑
摘要:001、 [root@PC1 test]# ls test.c [root@PC1 test]# cat test.c ## 测试程序 #include <stdio.h> int main(void) { int i; printf("i = "); scanf("%d", &i); //读取和输 阅读全文
posted @ 2024-07-28 20:30 小鲨鱼2018 阅读(36) 评论(0) 推荐(0) 编辑
摘要:001、 %f输出int型数据,其值为0. [root@PC1 test]# ls test.c [root@PC1 test]# cat test.c ## 测试程序 #include <stdio.h> int main(void) { int i = 10; printf("i = %f\n" 阅读全文
posted @ 2024-07-28 20:23 小鲨鱼2018 阅读(88) 评论(0) 推荐(0) 编辑
摘要:001、if 结构 002、if else结构 003、if else if elseif else结构 004、条件判断结构 005、switch结构 。 阅读全文
posted @ 2024-07-27 21:46 小鲨鱼2018 阅读(4) 评论(0) 推荐(0) 编辑
摘要:001、for [root@PC1 test]# ls test.c [root@PC1 test]# cat test.c ## 测试程序,for循环语句 #include <stdio.h> int main(void) { int i; for(i = 1; i <= 5; i++) { pr 阅读全文
posted @ 2024-07-27 13:38 小鲨鱼2018 阅读(38) 评论(0) 推荐(0) 编辑
摘要:001、 [root@PC1 test]# ls test.c [root@PC1 test]# cat test.c // 测试程序 #include <stdio.h> int main(void) { int i = 10; printf("i1 = %d\n", i); printf("i2 阅读全文
posted @ 2024-07-27 13:37 小鲨鱼2018 阅读(29) 评论(0) 推荐(0) 编辑
摘要:001、单行注释 // 002、多行注释 /* ......*/ 阅读全文
posted @ 2024-07-09 13:21 小鲨鱼2018 阅读(33) 评论(0) 推荐(0) 编辑
摘要:01、 libc: c标准库 02、glibc:gnu c库 03、libgcc:gcc 低级运行库 04、libstdc++:gnu c++库 参考: 01、https://blog.csdn.net/weixin_41973774/article/details/129806773 阅读全文
posted @ 2023-12-13 11:14 小鲨鱼2018 阅读(120) 评论(0) 推荐(0) 编辑
摘要:001、 [root@pc1 test01]# ls test.cpp [root@pc1 test01]# cat test.cpp ## 第一个c++程序 #include <iostream> using namespace std; int main() { cout << "hello w 阅读全文
posted @ 2023-10-26 15:43 小鲨鱼2018 阅读(11) 评论(0) 推荐(0) 编辑
摘要:001、 C语言的编译链接过程要把我们编写的一个c程序(源代码)转换成可以在硬件上运行的程序(可执行代码),需要进行编译和链接。 002、 编译就是把文本形式源代码翻译为机器语言形式的目标文件的过程。链接是把目标文件、操作系统的启动代码和用到的库文件进行组织形成最终生成可执行代码的过程 003、编译 阅读全文
posted @ 2023-08-17 22:40 小鲨鱼2018 阅读(154) 评论(0) 推荐(0) 编辑
摘要:c语言标准: 随着C语言在多个领域的推广、应用,一些新的特性不断被各种编译器实现并添加进来。于是,建立一个新的“无歧义、与具体平台无关的C 语言定义”成为越来越重要的事情。 作为软件行业中的老大哥级人物。C 语言也有自己的标准,而且是国际标准。 如果大家遵循同一个标准,那么就会避免分歧的产生,避免出 阅读全文
posted @ 2023-08-17 22:29 小鲨鱼2018 阅读(63) 评论(0) 推荐(0) 编辑
摘要:001、 #include <stdio.h> int test(int n) // 定义函数 { if(n > 0) { return n * test(n - 1); // 调用函数自身, 终止条件是n = 0 } else { return 1; } } int main(void) { in 阅读全文
posted @ 2022-08-19 00:56 小鲨鱼2018 阅读(199) 评论(0) 推荐(0) 编辑

上一页 1 2 3 4 5 6 7 ··· 30 下一页
点击右上角即可分享
微信分享提示