Πρόγραμμα για το θέμα 4: Morse

#include <stdio.h>

struct s_morse {
	char c;
	char *morse;
} morsetable[] = {
	'A', ".-",
	'B', "-...",
	'C', "-.-.",
};

main()
{
	int i, c;

	while ((c = getchar()) != EOF) {
		for (i = 0; i < sizeof(morsetable) / sizeof(struct s_morse); i++)
			if (c == morsetable[i].c)
				printf("%s\n", morsetable[i].morse);
	}
}