首页 > 其他 > 详细

自考新教材-p301_5(1)

时间:2020-02-05 12:25:16      阅读:74      评论:0      收藏:0      [点我收藏+]

源程序:

 

#include <iostream>
#include <string>
#include <iomanip>
using namespace std;

class student
{
private:
string name1;
float score1;
public:
int i;
student(string na, float sc)
{
name1=na;
score1 = sc;
}
void output()
{
cout << setw(10) << left << name1;
cout << setw(10) << right << score1 << endl;
}
};
int main()
{
string name;
float score;
for (int i = 0; i < 3; i++)
{
cin >> name >> score;
student stud(name, score);
stud.output();
}
system("pause");
return 1;
}

运行结果:

技术分享图片

 

自考新教材-p301_5(1)

原文:https://www.cnblogs.com/duanqibo/p/12263089.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!