Ana Sayfa
#include
#include
#include
#include
char *encode(const char *s);
int main(void)
{
char word[80];
char *morse = NULL;
printf("tt MORS ALFABESİntCOPYRIGHT © 2009 ADEM OZDEMİRnn t");
printf("Sozcugu yaziniz: ");
scanf("%s", word);
morse = encode(word);
printf("tMorse karsiligi: %sn",morse);
free(morse);
system("pause");
return 0;
}
char *encode(const char *s)
{
static char encoding[][5] =
{ ".-", "-...", "-.-.", "-..", ".", "..-.", "--.",
"....", "..", ".---", "-.-", ".-..", "--", "-.",
"---", ".--.", "--.-", ".-.", "...", "-", "..-",
"...-", ".--", "-..-", "-.--", "--.." };
char *morse[80];
int i;
morse[0] = ' ';
for (i = 0; s[i] != ' '; i++) {
strcat(morse, encoding[s[i] - 'a']);
strcat(morse, " ");
}
return morse;
}
Bu web sitesi ücretsiz olarak Bedava-Sitem.com ile oluşturulmuştur. Siz de kendi web sitenizi kurmak ister misiniz?
Ücretsiz kaydol