#3
by h1j1k1 » 6年前
抜粋するところを間違えていました。
すいません。
コート全体を送らせていただきます。
エラーコード
コード:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define GetRand (((unsigned int)((float)rand() / 32768.0)) * 10)
int main(void) {
const char* label = "print\n";
srand((unsigned int)time(NULL));
int s = GetRand;
if(s == 3) goto lbl;
while(0){
switch(s){
case 1:{
lbl:
int ed = s * GetRand;
printf("end(%d, %d)", s, ed);
goto end;
break;
}
case 0:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
case 9:{
printf(label);
printf(" = %d\n", label);
}
default:{
printf("error");
exit(1);
break;
}
}
s = GetRand;
}
end:
return 0;
}
エラー無しコード
コード:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define GetRand (((unsigned int)((float)rand() / 32768.0)) * 10)
int main(void) {
const char* label = "print\n";
srand((unsigned int)time(NULL));
int s = GetRand;
if(s == 3) goto lbl;
while(0){
switch(s){
case 1:{
lbl:
printf(""); // これ追記しただけです
int ed = s * GetRand;
printf("end(%d, %d)", s, ed);
goto end;
break;
}
case 0:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
case 9:{
printf(label);
printf(" = %d\n", label);
}
default:{
printf("error");
exit(1);
break;
}
}
s = GetRand;
}
end:
return 0;
}
暇つぶしに書いたものなので、コードの意味や効率は突っ込まないで頂けるとありがたいです。
[font=Lucida Console]
抜粋するところを間違えていました。
すいません。
コート全体を送らせていただきます。
エラーコード
[/font]
[code]
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define GetRand (((unsigned int)((float)rand() / 32768.0)) * 10)
int main(void) {
const char* label = "print\n";
srand((unsigned int)time(NULL));
int s = GetRand;
if(s == 3) goto lbl;
while(0){
switch(s){
case 1:{
lbl:
int ed = s * GetRand;
printf("end(%d, %d)", s, ed);
goto end;
break;
}
case 0:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
case 9:{
printf(label);
printf(" = %d\n", label);
}
default:{
printf("error");
exit(1);
break;
}
}
s = GetRand;
}
end:
return 0;
}
[/code]
[font=Lucida Console]
エラー無しコード
[/font]
[code]
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define GetRand (((unsigned int)((float)rand() / 32768.0)) * 10)
int main(void) {
const char* label = "print\n";
srand((unsigned int)time(NULL));
int s = GetRand;
if(s == 3) goto lbl;
while(0){
switch(s){
case 1:{
lbl:
printf(""); // これ追記しただけです
int ed = s * GetRand;
printf("end(%d, %d)", s, ed);
goto end;
break;
}
case 0:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
case 9:{
printf(label);
printf(" = %d\n", label);
}
default:{
printf("error");
exit(1);
break;
}
}
s = GetRand;
}
end:
return 0;
}
[/code]
[font=Lucida Console]
暇つぶしに書いたものなので、コードの意味や効率は突っ込まないで頂けるとありがたいです。
[/font]