、定义一个学生类,其中有3 个数据成员:学号、姓名、年龄,以及若干成员函数。同时编写main 函数使用这个类,实现对学生数据的赋值和输出
如有侵权请联系删除#include <iostream>#include<string>using namespace std;class student{int num;string name;int age;public:student(){num=0;name='\0';age=0;}student(int,string,i...
·
如有侵权请联系删除
#include <iostream>
#include<string>
using namespace std;
class student
{
int num;
string name;
int age;
public:
student(){num=0;name='\0';age=0;}
student(int,string,int);
void show();
};
student::student(int a,string b,int c):num(a),name(b),age(c){}
void student::show()
{
cout<<"student number:"<<ends<<num<<endl;
cout<<"name:"<<ends<<name<<endl;
cout<<"age:"<<ends<<age<<endl;
}
int main()
{
student s1(200803986,"zhangsan",23);
s1.show();
return 0;
}

GitCode 天启AI是一款由 GitCode 团队打造的智能助手,基于先进的LLM(大语言模型)与多智能体 Agent 技术构建,致力于为用户提供高效、智能、多模态的创作与开发支持。它不仅支持自然语言对话,还具备处理文件、生成 PPT、撰写分析报告、开发 Web 应用等多项能力,真正做到“一句话,让 Al帮你完成复杂任务”。
更多推荐
所有评论(0)