#include <iostream>
#include "ctime"
using namespace std;
class Singer{
public:
Singer(int num,string Name);
string name;
int number;
int counter;
int grade;
};
Singer::Singer(int num,string Name)
{
number=num;
name=Name;
counter++;
grade=(float)((8000+rand()%2001)/100);
}
int main(){
srand((int)time(NULL));
Singer a(1,"Tom");
Singer b(2,"David");
Singer c(3,"Mike");
cout << a.grade << endl;
cout << b.grade << endl;
cout << c.grade << endl;
return 0;
}
srand((int)time(NULL));//放入主函数中,埋下随机种子,防止每次出现一样的随机数