摘要: 1.题目要求:从栈或从堆实例化对x和y进行任意赋值 2.代码如下: #include <iostream> #include <stdlib.h> using namespace std; class Coordinate { public: int x; int y; void printX() 阅读全文
posted @ 2020-09-11 16:17 攻城狮小关 阅读(346) 评论(0) 推荐(0) 编辑
摘要: 1.题目如下: 2.代码分享如下: include <iostream> #include <stdlib.h> using namespace std; int main(void) { string name; cout << "please input your name:" << endl; 阅读全文
posted @ 2020-09-11 09:34 攻城狮小关 阅读(232) 评论(0) 推荐(0) 编辑
摘要: 1.题目要求:定义一个Student类,包含名字和年龄两个数据成员,实例化一个Student对象,并打印出其成两个数据成员 2.分享代码如下: #include <iostream> #include <string> using namespace std; /** * 定义类:Student * 阅读全文
posted @ 2020-09-11 09:03 攻城狮小关 阅读(655) 评论(0) 推荐(0) 编辑