-
-
Save anonymous/4ef2174c695ab92d704c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
enum result {D, C, B, A, S, Invalid}; | |
enum result seiseki_hantei(int sc){ | |
if(sc>= 0 && sc<=59) return D; | |
if(sc>=60 && sc<=69) return C; | |
if(sc>=70 && sc<=79) return B; | |
if(sc>=80 && sc<=89) return A; | |
if(sc>=90 && sc<=100) return S; | |
return Invalid; | |
} | |
void print_seiseki(enum result res){ | |
switch(res){ | |
case D: puts("成績はDです。"); break; | |
case C: puts("成績はCです。"); break; | |
case B: puts("成績はBです。"); break; | |
case A: puts("成績はAです。"); break; | |
case S: puts("成績はSです。"); break; | |
default: puts("Invalid"); | |
} | |
} | |
int main(void){ | |
int data=0; | |
printf("点数(整数)を入力してください:"); | |
scanf("%d", &data); | |
print_seiseki(seiseki_hantei(data)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment