1
上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 20 下一页
摘要: C++常用语法知识--数据类型 C++为用户提供了7种基本C++数据类型: 类型 关键字 字节大小 布尔型 bool 1 字符型 char 1 有符号字符型 signed char 1 无符号字符型 unsigned char 1 整型 int 4 有符号整型 signed int 4 无符号整型 阅读全文
posted @ 2023-10-24 09:59 Bonne_chance 阅读(19) 评论(0) 推荐(0)
摘要: C++常用语法知识-- std::istringstream 介绍 std::istringstream是C++标准库中的一个类,它用于从字符串中提取数据,并将数据转换为不同的数据类型。通常从字符串中解析数据,例如整数、浮点数等。 使用方法 创建std::istringstream对象,首先,需要创 阅读全文
posted @ 2023-10-24 09:54 Bonne_chance 阅读(2582) 评论(0) 推荐(0)
摘要: C++常用语法知识--双冒号 作用域符号::的前面一般是类名称,后面一般是该类的成员名称,C++为避免不同的类有名称相同的成员而采用作用域的方式进行区分 例如:A、B表示两个类,在A、B中都有成员member。 A:: member就表示类A中的成员member B:: member就表示类B中的成 阅读全文
posted @ 2023-10-23 20:25 Bonne_chance 阅读(658) 评论(0) 推荐(1)
摘要: C语言-条件编译 问题 加入现在要开发一个C语言程序,跨平台输出红色字体,也就是在Windows和Linux下都能运行,怎么办呢? 这个程序的难点在不同平台下控制文字颜色的代码不一样,必须要先识别出不同的平台。 Windows有专有的宏_WIN32,Linux有专有的宏__linux__。 错误的i 阅读全文
posted @ 2023-10-23 11:11 Bonne_chance 阅读(46) 评论(0) 推荐(0)
摘要: C语言-时间处理(当前时间,时间戳转时间,时间转时间戳) 输出当前时间 #include <stdio.h> #include <time.h> int main () { time_t rawtime; struct tm *info;//指向tm结构的指针 char buffer[80]; ti 阅读全文
posted @ 2023-10-19 16:43 Bonne_chance 阅读(2494) 评论(0) 推荐(0)
摘要: C语言-常用函数 _finddata_t结构体用法 功能:用来存储文件各种信息的结构体 依赖:头文件<io.h> 主要语法: struct _finddata_t{ unsigned attrib; time_t time_create; time_t time_access; time_t tim 阅读全文
posted @ 2023-10-18 20:26 Bonne_chance 阅读(95) 评论(0) 推荐(0)
摘要: C语言-读取一个目录中的文件,并将文件名写入数组 注意点: 文件名是字符串,放入数组,需要数组二维数组,array[m][n], m表示字符串的个数,n表示字符串的长度; 使用函数char* strcpy(char* destination,const char* source), 例如: char 阅读全文
posted @ 2023-10-18 16:36 Bonne_chance 阅读(350) 评论(0) 推荐(0)
摘要: C语言-结构体使用 #include <stdio.h> #include <stdlib.h> #include <string.h> //结构体 /*结构体定义*/ struct Person{ char name[20]; int age; }; int main(){ /*结构体赋值*/ s 阅读全文
posted @ 2023-10-18 12:33 Bonne_chance 阅读(19) 评论(0) 推荐(0)
摘要: C语言-数组初始化方式 # include <stdio.h> # include <string.h> //数组初始化 int main(){ //方式1:{0} int arr1[3] = {0}; for(int i= 0;i<3;i++){ printf("arr1[%d] = %d\n", 阅读全文
posted @ 2023-10-18 12:06 Bonne_chance 阅读(111) 评论(0) 推荐(0)
摘要: 输入一行字符,分别统计其中中英文字母、空格、数字和其他字符的个数 #include <stdio.h> //输入一行字符,分别统计其中中英文字母、空格、数字和其他字符的个数 int main(){ char c; int letters = 0; int spaces = 0; int digits 阅读全文
posted @ 2023-10-17 19:37 Bonne_chance 阅读(814) 评论(0) 推荐(0)
上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 20 下一页
1