03 2021 档案

摘要:1. 关于string中是否\0结尾 string:标准中未规定需要\0作为字符串结尾。编译器在实现时既可以在结尾加\0,也可以不加。(因编译器不同) 但是,当通过c_str()或data()(二者在 C++11 及以后是等价的)来把std::string转换为const char *时,会发现最后 阅读全文
posted @ 2021-03-31 15:54 11YS 阅读(50) 评论(0) 推荐(0)
摘要:1. c++支持分离式编译,可以将声明和定义区分开,声明使得名字为程序所知,定义是创建一个与名字关联的实体。 2. long double ld = 3.1415926; int a{ld}, b = {ld}; 列表初始化时,如果初始值存在丢失信息风险,编译器会报错。 long double ld 阅读全文
posted @ 2021-03-30 14:55 11YS 阅读(33) 评论(0) 推荐(0)
摘要:#include <iostream>int main(){ std::cout << "Hello, World" << std::endl; return 0;} 1.9while实现50-100和 #include <iostream> using namespace std; int mai 阅读全文
posted @ 2021-03-29 16:32 11YS 阅读(96) 评论(0) 推荐(0)