Commit c2313242 authored by elijah vasquez's avatar elijah vasquez 🦍

I DID IT

parent dbeaad87
// Task 9 // Task 9
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <stdlib.h>
#include <ctype.h>
enum alphaBet{a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z}; int main()
{
int main(){ char morseCode[26][6] = {
char *morseCode[] = {
".-", //A ".-", //A
"-...", //B "-...", //B
"-.-.", //C "-.-.", //C
...@@ -34,14 +35,22 @@ int main(){ ...@@ -34,14 +35,22 @@ int main(){
"--..", //Z "--..", //Z
}; };
char keyInput[50]; char keyInput[1000];
//enum alphaBet keyInput; size_t i = 0;
printf("Enter string: "); printf("Enter string: ");
scanf("%s", keyInput); gets(keyInput);
printf("\ndecoded: %s", keyInput);
for (int i = 0; i < 26; i++){
printf("%s\n", morseCode[i]);
}
while (keyInput[i] != '\0')
{
if(keyInput[i] != ' ')
{
printf("%s\n", morseCode[tolower(keyInput[i] - 97)]);
}
if(keyInput[i] == ' ')
{
printf(" \n");
}
i++;
}
return 0; return 0;
} }
No preview for this file type
enum engAlphabet {a,};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment