2021年1月16日

宽窄字节字符串的转换

摘要: 4、小作业:熟练使用API方式及CA2W、CW2A、CT2W、CT2A类方式进行宽窄字符串的转换。多加练习才行! #include <iostream> #include "atlbase.h" #include "atlstr.h" using namespace std; int main() 阅读全文

posted @ 2021-01-16 21:12 SakuraQAQ 阅读(211) 评论(0) 推荐(0)

宽窄字节的区别及重要性

摘要: 5、小作业:大家回去查查,如何使用宽字节字符串进行字符串的拷贝工作?默认我们以前使用 strcpy 来进行字符串的拷贝,那么宽字节呢? #include <iostream> using namespace std; int main() { //locale::global(locale("")) 阅读全文

posted @ 2021-01-16 21:04 SakuraQAQ 阅读(130) 评论(0) 推荐(0)

C++中的字符串类stirng②

摘要: 6、小作业:将以下字符串以#号为分隔符进行分割,将分割后的各个子串的结果存储到一个 vector 中,字符串如下:123#ab##cctry.com# #include <iostream> #include <string> #include <vector> using namespace st 阅读全文

posted @ 2021-01-16 16:55 SakuraQAQ 阅读(79) 评论(0) 推荐(0)

2021年1月15日

C++中的字符串类stirng①

摘要: #include <iostream> #include <string> using namespace std; int main() { string s_1; s_1 = "aaaaa"; s_1.clear(); char* c_1 = "bbbb"; s_1.assign(c_1); s 阅读全文

posted @ 2021-01-15 21:38 SakuraQAQ 阅读(53) 评论(0) 推荐(0)

C++容器之映射map

摘要: 8、小作业:定义一个 map<int, char> 类型的对象:依次存入以下内容:10010->'m'10011->'f'10012->'f'10013->'m'10014->'f'10015->'m'之后,使用 for 循环删除map中的value值为 'f' 的元素,并将结果输出出来! #inc 阅读全文

posted @ 2021-01-15 19:54 SakuraQAQ 阅读(86) 评论(0) 推荐(0)

C++容器之链表list②

摘要: 5、小作业:定义一个 int 类型的 list 动态链表,将以下元素:1, 4, 3, 7, 9, 3, 6, 8, 3, 5, 2, 3, 7 插入到动态链表中。之后,使用 for 循环删除动态链表中的值为 3 的元素,并将结果输出出来! #include <iostream> #include 阅读全文

posted @ 2021-01-15 17:14 SakuraQAQ 阅读(108) 评论(0) 推荐(0)

C++容器之链表list①

摘要: 5、小作业:能不能通过 list 的构造函数,实现将一个 vector 对象里面的内容赋值给 list 对象呢?大家课后试试吧! #include <iostream> #include <vector> #include <list> using namespace std; int main() 阅读全文

posted @ 2021-01-15 16:48 SakuraQAQ 阅读(92) 评论(0) 推荐(0)

C++容器之动态数组vector②

摘要: 5、小作业:定义一个 int 类型的 vector 动态数组,将以下元素:1, 4, 3, 7, 9, 3, 6, 8, 3, 5, 2, 3, 7 插入到动态数组中。之后,使用 for 循环删除动态数组中的值为 3 的元素,并将结果输出出来! #include <iostream> #includ 阅读全文

posted @ 2021-01-15 15:36 SakuraQAQ 阅读(74) 评论(0) 推荐(0)

2021年1月14日

C++容器之动态数组vector①

摘要: 5、小作业:使用之前课程中讲解的 CStudent 类型来定义多个 vector 动态数组,并进行初始化操作! #include <iostream> #include <vector> using namespace std; class Student { char* p_name; int a 阅读全文

posted @ 2021-01-14 22:30 SakuraQAQ 阅读(122) 评论(0) 推荐(0)

文件IO操作之文件指针

摘要: 4、小作业:通过文件读写的方式,自己实现一个函数,实现文件的拷贝功能。 #include <iostream> #include <fstream> using namespace std; bool copy_file(const char* x, const char* y ) { //读取 i 阅读全文

posted @ 2021-01-14 19:14 SakuraQAQ 阅读(120) 评论(0) 推荐(0)

导航