1.概要
c++11 新特性 类型推断 字符
2.代码
#include <iostream>
#include <vector>
int main()
{
std::string str = "Hello, World!";
for (auto c : str) {
std::cout << c << " ";
}
std::cout << "\nHello World!\n";
}
3.运行结果
H e l l o , W o r l d !
Hello World!
本文介绍了C++11引入的新特性——类型推断,并通过一个简单的`main()`函数示例展示了如何在`std::string`字符处理中使用它。程序输出了字符串两次,展示了类型推断的功能。
2万+

被折叠的 条评论
为什么被折叠?



