este codigo en FWH ?
algun guru ?
saludos.
/*
** Text to Morse Code Converter
**
** Copyright (C) 2005 Ram贸n E. Torres Salom贸n
*/
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#ifdef _MSC_VER
#include <windows.h>
#else
#include <dos.h>
#endif
#define MORSE_BEEP_FREQ 聽 聽 聽 聽800 // 0.8KHz
// Timers
#define MORSE_DOT_TIME 聽 聽 聽 聽70
#define MORSE_DASH_TIME 聽 聽 聽 聽210
#define MORSE_CHARACTER_SEPARATION 聽MORSE_DOT_TIME*3
#define MORSE_WORD_SEPARATION 聽 聽MORSE_DOT_TIME*7
// Functions prototipes
void playsound(int note, int duration);
void morse(char c);
int main(void)
{
聽 char buffer[256];
聽 printf("Raymondjavaxx Text to Morse Code Converter\n");
聽 printf("------------------------------------------\n");
聽 printf("Type a text and press enter: ");
聽 gets(buffer);
聽 int x=0;
聽 while(buffer[x])
聽 {
聽 聽 if(buffer[x] == ' ')
聽 聽 {
聽 聽 聽 printf("\n");
聽 聽 聽 while(buffer[x] == ' ')
聽 聽 聽 聽 x++;
聽 聽 聽 if(buffer[x] == NULL)
聽 聽 聽 聽 break;
#ifdef _MSC_VER
聽 聽 聽 Sleep(MORSE_WORD_SEPARATION);
#else
聽 聽 聽 delay(MORSE_WORD_SEPARATION);
#endif
聽 聽 }
聽 聽 morse(buffer[x]);
聽 聽 x++;
聽 }
聽 system("PAUSE");
聽 return 0;
}
/*********
* func: morse
* desc: morse parsing function
********************************************/
void morse(char c)
{
聽 char code[8] = {0};
聽 switch(toupper(c))
聽 {
聽 // Letter Morse
聽 case 'A': strcpy(code, ".-"); 聽break;
聽 case 'B': strcpy(code, "-..."); break;
聽 case 'C': strcpy(code, "-.-."); break;
聽 case 'D': strcpy(code, "-.."); 聽break;
聽 case 'E': strcpy(code, "."); 聽break;
聽 case 'F': strcpy(code, "..-."); break;
聽 case 'G': strcpy(code, "--."); 聽break;
聽 case 'H': strcpy(code, "...."); break;
聽 case 'I': strcpy(code, ".."); 聽break;
聽 case 'J': strcpy(code, "-.-."); break;
聽 case 'K': strcpy(code, "-.-"); 聽break;
聽 case 'L': strcpy(code, ".-.."); break;
聽 case 'M': strcpy(code, "--"); 聽break;
聽 case 'N': strcpy(code, "-."); 聽break;
聽 case 'O': strcpy(code, "---"); 聽break;
聽 case 'P': strcpy(code, ".--."); break;
聽 case 'Q': strcpy(code, "--.-"); break;
聽 case 'R': strcpy(code, ".-."); 聽break;
聽 case 'S': strcpy(code, "..."); 聽break;
聽 case 'T': strcpy(code, "-"); 聽break;
聽 case 'U': strcpy(code, "..-"); 聽break;
聽 case 'V': strcpy(code, "...-"); break;
聽 case 'W': strcpy(code, ".--"); 聽break;
聽 case 'X': strcpy(code, "-..-"); break;
聽 case 'Y': strcpy(code, "-.--"); break;
聽 case 'Z': strcpy(code, "--.."); break;
聽 // Digit Morse
聽 case '0': strcpy(code, "-----"); break;
聽 case '1': strcpy(code, ".----"); break;
聽 case '2': strcpy(code, "..---"); break;
聽 case '3': strcpy(code, "...--"); break;
聽 case '4': strcpy(code, "....-"); break;
聽 case '5': strcpy(code, "....."); break;
聽 case '6': strcpy(code, "-...."); break;
聽 case '7': strcpy(code, "--..."); break;
聽 case '8': strcpy(code, "---.."); break;
聽 case '9': strcpy(code, "----."); break;
聽 // Others
聽 case '.': strcpy(code, ".-.-.-"); break;
聽 case ',': strcpy(code, "--..--"); break;
聽 case '?': strcpy(code, "..--.."); break;
聽 default: printf("[invalid character '%c']\n", c); break;
聽 }
聽 for(int i=0; i<8; i++)
聽 {
聽 聽 if(code[i] == '-')
聽 聽 {
聽 聽 聽 printf("%c", code[i]);
聽 聽 聽 playsound(MORSE_BEEP_FREQ, MORSE_DASH_TIME);
聽 聽 }
聽 聽 else if(code[i] == '.')
聽 聽 {
聽 聽 聽 printf("%c", code[i]);
聽 聽 聽 playsound(MORSE_BEEP_FREQ, MORSE_DOT_TIME);
聽 聽 }
聽 }
聽 printf("\n");
}
/*********
* func: playsound
* desc: play a note with pc internal speaker
********************************************/
void playsound(int note, int duration)
{
#ifdef _MSC_VER
聽 Beep(note, duration);
聽 Sleep(MORSE_CHARACTER_SEPARATION);
#else
聽 sound(note);
聽 delay(duration);
聽 nosound();
聽 delay(MORSE_CHARACTER_SEPARATION);
#endif
}SysCtrl Software
Mexico
' Sin +- FWH es mejor "
[/URL]