Skip to content

Commit

Permalink
数字と記号を追加
Browse files Browse the repository at this point in the history
  • Loading branch information
wada-jun8 committed Nov 26, 2024
1 parent 255f4ac commit efa9c36
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions morse.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ int main(){
while((c = getchar()) != '\n'){
if(isalpha(c)){
c = tolower(c);

if(c == 'a') printf("・ー");
else if(c == 'b') printf("ー・・・");
else if(c == 'c') printf("ー・ー・");
Expand Down Expand Up @@ -41,9 +40,23 @@ int main(){
else if(c == 'z') printf("ーー・・");
}

else if(isdigit(c) || c == '.'){
printf("%c",c);
}
else if(c == '0') printf("ーーーーー");
else if(c == '1') printf("・ーーーー");
else if(c == '2') printf("・・ーーー");
else if(c == '3') printf("・・・ーー");
else if(c == '4') printf("・・・・ー");
else if(c == '5') printf("・・・・・");
else if(c == '6') printf("ー・・・・");
else if(c == '7') printf("ーー・・・");
else if(c == '8') printf("ーーー・・");
else if(c == '9') printf("ーーーー・");

else if(c == '.') printf("・ー・ー・ー");
else if(c == ',') printf("ーー・・ーー");
else if(c == '?') printf("・・ーー・・");
else if(c == '-') printf("ー・・・・ー");
else if(c == '/') printf("ー・・ー・");
else if(c == '@') printf("・ーー・ー・");
}
printf("\n");
}
Expand Down

0 comments on commit efa9c36

Please sign in to comment.