为什么我在VS上运行,它直接跳出去了啊,但显示的是运行成功
为什么我在VS上运行,它直接跳出去了啊,但显示的是运行成功
为什么我在VS上运行,它直接跳出去了啊,但显示的是运行成功
2017-12-27
以下是我的代码
#include <iostream>
#include <string>
using namespace std;
/**
* 定义类:Student
* 数据成员:名字、年龄
*/
class Student
{
public:
string m_strName;
int m_iAge;
// 定义数据成员名字 m_strName 和年龄 m_iAge
};
int main()
{
Student stu;// 实例化一个Student对象stu
// 设置对象的数据成员
stu.m_strName = "慕课网";
stu.m_iAge = 2;
// 通过cout打印stu对象的数据成员
cout << stu.m_strName << " " << stu.m_iAge << endl;
return 0;
}
举报