福島核事故十週年:核能在世界能源版圖中將何去何從
阿新 • • 發佈:2021-03-12
隨機數 srand((unsigned int)time(NULL));
隨機數標頭檔案 #include < ctime>
#include"string" 字串頭
struct student
{
string sName;
int age;
int score;
};
struct teacher
{
string tName;
struct student sArray[5];
};
void allocateSpace(struct teacher tArray[], int len)
{
string nameSeed = “ABCDE”;
for (int i = 0; i < len; i++){
tArray[i].tName += nameSeed[i];
for (int j = 0; j < 5; j++)
{
tArray[i].sArray[j].sName = “student_”;
tArray[i].sArray[j].sName += nameSeed[j];
int random = rand() % 61+40;
tArray[i].sArray[j].score = random;
}
}
};
string aba=“abcd”;
string a=“name_";
a+=aba[0];