- 2
- 0
- 约小于1千字
- 约 3页
- 2018-05-06 发布于河南
- 举报
c小程序练习16
16.
#include iostream.h
#include string.h
class Stud
{
private :
int number;
char name[20];
double score;
public :
Stud(int n,char std[],double s)
{
number=n;
strcpy(name,std);
score=s;
}
void display()
{
cout学生信息为:endl;
cout学号:numberendl;
cout姓名:nameendl;
cout分数:scoreendl;
}
};
void main()
{
int N;
char Name[20];
double S;
cout 请输入学生学号:endl;
cinN;
cout请输入学生姓名:endl;
cinName;
cout请输入学生成绩:endl;
try
{
cinS;
if(S0||S150)
{
throw S;
}
Stud stu(N,Name,S);
stu.display();
}
catch(double)
{
cout你输入的成绩不正确。(分数只能在0-150之间)endl;
}
}
您可能关注的文档
最近下载
- 《三七总皂苷生产车间工艺设计》15000字.docx
- 综合学术英语教程2 答案.doc VIP
- 2025年中考英语三轮冲刺:必背39篇热点话题作文满分范文汇编.pdf VIP
- 全国2024年中考化学真题汇编质量守恒定律专题含解析.doc VIP
- 音乐剧《歌剧魅影》选段《别无所求》的音乐特征与演唱技巧分析.pdf
- 主题班会:同学之间友好相处PPT课件.ppt VIP
- 2025年全国职业院校技能大赛护理技能赛项规程【模板】 .pdf VIP
- 江苏省南京市金陵中学2024-2025学年高一3月月考语文试题(原卷版+解析版).docx VIP
- 2025年中考语文作文模拟预测:《当_____遇见诗意》写作指导+佳作展示.doc VIP
- 新时代主题大学英语进阶快速阅读2第二版习题答案.pdf VIP
原创力文档

文档评论(0)