04 2024 档案
摘要:#include <stdio.h> int main() { int n1 = 10; // 十进制 int n2 = 0b10; // 二进制 int n3 = 017; // 八进制 int n4 = 0x1a; // 十六进制 // 以十进制的方式打印 printf("%d\n", n1);
阅读全文
摘要:#include <stdio.h> int main() { // 练习:计算圆的面积,其半径由用户指定 float radius; // 圆的半径 printf("enter radius: "); scanf("%f", &radius); // 理解为阻塞式函数 const float PI
阅读全文
摘要:多种方式定义常量 使用宏定义表示的常量没有数据类型。 #include <stdio.h> #define ZERO 0 #define PI 3.1415 int main() { // 1.字面常量 3.14; // 字面常量 1000; // 字面常量 // 2. #define printf
阅读全文
摘要:1、基本数据类型 1.1 整数类型 1.2 浮点类型 1.3 字符类型 1.4 布尔类型 #include <stdio.h> #include <stdbool.h> // 使用宏定义 #define TRUE 1 #define BOOL int int main() { // 第1种处理方式
阅读全文
摘要:一、编写 命名为xxx.c文件 #include <stdio.h> int main() { printf("hello,world!"); getchar(); 用于双击可执行文件时窗口停留不关闭 return 0; } 二、编译 使用编译器GCC进行编译,GCC是C语言的跨平台编译器,现在安装
阅读全文