因此,我目前正在学习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;
}
Run Code Online (Sandbox Code Playgroud)