gpt4 book ai didi

c++ - 还需要字符串头文件吗?

转载 作者:太空宇宙 更新时间:2023-11-04 15:11:37 25 4
gpt4 key购买 nike

<分区>

所以我现在正在学习 C++,在某些时候我看到你“必须”#include <string>在代码的顶部使用字符串。但是当我运行我的代码时,它在两种情况下都做同样的事情。所以真的需要使用它吗?

#include <iostream>
using namespace std;

int main()
{
string fullName;
cout << "Type your full name: ";
getline(cin, fullName);
cout << "Your name is: " << fullName;

}

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com