#include <stdio.h>
#include <stdlib.h>
#include <time.h> //乱数の生成のため
//プログラミング及び演習4_第2回_提出課題3
typedef struct {
char na[64];
int stts[6];
} Monster;
Monster creMonster(){
int i,k;
Monster tmp;
for(i
=0;i
<k
;i
++) tmp.
na[i
] = 'a' + rand()%26; tmp.na[k] = '\0';
for(i
=0;i
<6;i
++) tmp.
stts[i
] = rand()%255+1; return tmp;
}
void priMonster(Monster m){
for(int i=0;i<6;i++)
}
int main(){
srand((unsigned)time(NULL
)); //乱数を生成する時のおまじない int i, n;
Monster *monsters;
//ここに1行で monstersにn体のモンスターの領域を確保する
monsters
=(Monster
*)malloc(88*n
); //以下はいじらなくてOK
if(monsters == NULL){
return 0;
}
for(i=0;i<n;i++){
monsters[i] = creMonster();
priMonster(monsters[i]);
}
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRsaWIuaD4KI2luY2x1ZGUgPHRpbWUuaD4gLy/kubHmlbDjga7nlJ/miJDjga7jgZ/jgoEKLy/jg5fjg63jgrDjg6njg5/jg7PjgrDlj4rjgbPmvJTnv5I0X+esrDLlm55f5o+Q5Ye66Kqy6aGMMwp0eXBlZGVmIHN0cnVjdCB7CiAgICBjaGFyIG5hWzY0XTsKICAgIGludCBzdHRzWzZdOwp9IE1vbnN0ZXI7CgpNb25zdGVyIGNyZU1vbnN0ZXIoKXsKICAgIGludCBpLGs7CiAgICBNb25zdGVyIHRtcDsKICAgIGsgPSByYW5kKCklOCs0OwogICAgaW50IGEgPSAnYScgKyByYW5kKCklMjY7CiAgICBmb3IoaT0wO2k8aztpKyspIHRtcC5uYVtpXSA9ICdhJyArIHJhbmQoKSUyNjsKICAgIHRtcC5uYVtrXSA9ICdcMCc7CiAgICBmb3IoaT0wO2k8NjtpKyspIHRtcC5zdHRzW2ldID0gcmFuZCgpJTI1NSsxOwogICAgcmV0dXJuIHRtcDsKfQoKdm9pZCBwcmlNb25zdGVyKE1vbnN0ZXIgbSl7CiAgICBwcmludGYoIiUxMnMgIDogIixtLm5hKTsKICAgIGZvcihpbnQgaT0wO2k8NjtpKyspCiAgICAgICAgcHJpbnRmKCIlM2QgIixtLnN0dHNbaV0pOwogICAgcHJpbnRmKCJcbiIpOwp9CgppbnQgbWFpbigpewogICAgc3JhbmQoKHVuc2lnbmVkKXRpbWUoTlVMTCkpOyAvL+S5seaVsOOCkueUn+aIkOOBmeOCi+aZguOBruOBiuOBvuOBmOOBquOBhAogICAgaW50IGksIG47CiAgICBNb25zdGVyICptb25zdGVyczsKICAgIHNjYW5mKCIlZCIsJm4pOwogICAgLy/jgZPjgZPjgavvvJHooYzjgacgbW9uc3RlcnPjgatu5L2T44Gu44Oi44Oz44K544K/44O844Gu6aCY5Z+f44KS56K65L+d44GZ44KLCiAgICBtb25zdGVycz0oTW9uc3RlciopbWFsbG9jKDg4Km4pOwogICAgLy/ku6XkuIvjga/jgYTjgZjjgonjgarjgY/jgabvvK/vvKsKICAgIGlmKG1vbnN0ZXJzID09IE5VTEwpewogICAgICAgIHByaW50ZigiRVJST1JcbiIpOwogICAgICAgIHJldHVybiAwOwogICAgfQogICAgZm9yKGk9MDtpPG47aSsrKXsKICAgICAgICBtb25zdGVyc1tpXSA9IGNyZU1vbnN0ZXIoKTsKICAgICAgICBwcmludGYoIiUwM2QgICIsaSsxKTsKICAgICAgICBwcmlNb25zdGVyKG1vbnN0ZXJzW2ldKTsKICAgIH0KICAgIGZyZWUobW9uc3RlcnMpOwogICAgcmV0dXJuIDA7Cn0K