gpt4 book ai didi

c++ - 如何包含字符串标题?

转载 作者:IT老高 更新时间:2023-10-28 12:46:27 26 4
gpt4 key购买 nike

我正在尝试了解 string s,但不同的来源告诉我要包含不同的标题。

有人说要用<string.h> ,但其他人提到 "apstring.h" .我可以用 apstring 做一些基本的事情,但有人告诉我另一个更强大。当我包括 <string.h>并尝试声明一些字符串变量,但是,我得到了错误。正确的用法是什么?

最佳答案

您想包含 <string>并使用 std::string :

#include <string>
#include <iostream>

int main()
{
std::string s = "a string";
std::cout << s << std::endl;
}

但您真正需要做的是获得 introductory level book .你不会以任何其他方式正确学习,当然也不会在线获取信息。

关于c++ - 如何包含字符串标题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4103169/

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