read all code including space, morse code

need it asap. help.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
  printf("\n\n\tEnter a line of Morse Code for decrypting\n\n");     
  scanf("%s",phr);
  len=strlen(phr);
      printf("\nConverting the Morse Code.... \n");

    while(*phr!='\0')
    { //I struggled with getting the input to read all the characters before 
      //the space as 1 index so I came up with a for loop.  It is supposed to
      //read to the space and copy the contents of that string in the 
      //array index, but it didnt work. However, just like my other function, it will not read the null
      // character and exit the loop.    
      scanf("%s", phr);
      for(a=0; a<36; a++)
      {
         if(strcmp(phr, morse[a])==0)
            printf("%c", alpha[a]);
            
      }                     
      
Topic archived. No new replies allowed.