c++小问题,求大佬帮忙看看

#include <iostream>
#include <string.h>
using namespace std;

class student
{
public:
string m_strName;
int m_iAge;
};

int main(void)
{
student stu;
stu.m_iAge = 2;
stu.m_strName = "慕课网";

cout<<stu.m_strName <<endl;
system("pause");
return 0;
}

vs编译不通过 codeblocks编译就通过,求大佬帮忙看看哪里出了问题,谢谢
#C++工程师#
全部评论
<string.h>是C版本的头文件,<string>是C++版本的,此处是cout输出,应该用<string>库的字符串。
点赞 回复 分享
发布于 2017-12-11 20:45
提示什么错误
点赞 回复 分享
发布于 2017-12-11 20:43
头文件应该是string
点赞 回复 分享
发布于 2017-12-11 20:39

相关推荐

缒梦&独舞:这家公司是这样的,去年给我实习offer了,不过也是面着玩儿的,他周六还要去做公益志愿活动
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务