student{
courses: [
{
name: '数学',
score: '{{floating(10, 100, 2)}}'
},
{
name: '英语',
score: '{{floating(10, 100, 2)}}'
},
{
name: 'C++',
score: '{{floating(10, 100, 2)}}'
}
],
}
friends: [
'{{repeat(3,5)}}',
{
id: '{{index()}}',
name: '{{firstName()}}*{{surname()}}',
#include<iostream>
#include<algorithm>
#include<time.h>
#include<string>
#include <iomanip>
using namespace std;
class student
{
public:
void course()
{
float grade;
string name[3] = { "数学","英语","C++" };
for (int i = 0; i < 3; i++)
{
grade = (rand() % 9000 + 1000) / 100.0;
cout << name[i] << " " <<fixed<< setprecision(2) << grade << endl;
}
}
};
int main()
{
srand((unsigned int)time(NULL));
student s;
s.course();
return 0;
}