2021年3月2日星期二

How do I fix this code that encodes a morse code?

So, I have a question, and that is What is the error in this code? I'm confused, and I have tried a lot of methods, none seem to work. Can you please help me? I really need it. Thanks, You're really helpful. This code is morse code, but it has a brackets error. I can't fix it. I added the entire alphabet to it, is this helpful? Please help.

#include "stdio.h"  int main(void) {  printf("This code will make a morse code. Enter lowercase letters");      switch {      case 'a':          return ".-";      case 'b':          return "-...";      case 'c':          return "-.-.";      case 'd':          return "-..";      case 'e':          return ".";      case 'f':          return "..-.";      case 'g':          return "--.";      case 'h':          return "....";      case 'i':          return "..";      case 'j':          return ".---";      case 'k':          return "-.-";      case 'l':          return ".-..";      case 'm':          return "--";      case 'n':          return "-.";      case 'o':          return "---";      case 'p':          return ".--.";      case 'q':          return "--.-";      case 'r':          return ".-.";      case 's':          return "...";      case 't':          return "-";      case 'u':          return "..-";      case 'v':          return "...-";      case 'w':          return ".--";      case 'x':          return "-..-";      case 'y':          return "-.--";      case 'z':          return "--..";      case '1':          return ".----";      case '2':          return "..---";      case '3':          return "...--";      case '4':          return "....-";      case '5':          return ".....";      case '6':          return "-....";      case '7':          return "--...";      case '8':          return "---..";      case '9':          return "----.";      case '0':          return "-----";                default:           printf("Found wrong characters");          exit(0);      }    return 0;  }  
https://stackoverflow.com/questions/66450643/how-do-i-fix-this-code-that-encodes-a-morse-code March 03, 2021 at 12:06PM

没有评论:

发表评论