Submission
Status:
PPPPPPPPPP
Score: 100
User: akuyga1
Problemset: ลูกเต๋า
Language: c
Time: 0.001 second
Submitted On: 2024-10-02 00:27:30
#include<stdio.h>
struct dice {
char upper[4];
char mid[4];//it's 4 not 4 for null
char lower[4];
};
int main() {
struct dice index[6] = { {{" "},{" * "},{" "}},{{" "},{"* *"},{" "}}
,{{" * "},{" * "},{" * "}},{ { "* *" },{" "},{"* *"} },{{"* *"},{" * "},{"* *"}},{{"* *"},{"* *"},{"* *"}} };
char input[3];
scanf("%s", input);
if (input[0] - '0' <= 6 && input[0] - '0' > 0 && input[1] - '0' <= 6 && input[1] - '0' > 0 && input[2] - '0' <= 6 && input[2] - '0' > 0) {
printf("%s", index[input[0] - '0'-1].upper);
printf("|");
printf("%s", index[input[1] - '0'-1].upper);
printf("|");
printf("%s\n", index[input[2] - '0' - 1].upper);
printf("%s", index[input[0] - '0' - 1].mid);
printf("|");
printf("%s", index[input[1] - '0' - 1].mid);
printf("|");
printf("%s\n", index[input[2] - '0' - 1].mid);
printf("%s", index[input[0] - '0' - 1].lower);
printf("|");
printf("%s", index[input[1] - '0' - 1].lower);
printf("|");
printf("%s\n", index[input[2] - '0' - 1].lower);
}
else { printf("ERROR"); }
}
//this shit let me know that to create an array goota be a space for void