Zdar lidi ,
mám tady problém. Program mi text přeloží do morseovky ,ale neuloží se morsovka, ale ten text. Co mám dělat ???
#include <iostream>
#include <cstring>
using namespace std;
void prelozeniDoMorseovky(char[50]);
int main()
{
naZacatek:
char textKPrelozeni[50];
cin >> textKPrelozeni;
prelozeniDoMorseovky(textKPrelozeni);
goto naZacatek;
system("PAUSE");
return 0;
}
void prelozeniDoMorseovky(char prelozeny[])
{
int pocetZnaku;
pocetZnaku = strlen(prelozeny);
cout << "\n\a\a";
for (int i = 0 ; i < pocetZnaku; i ++)
{
if (prelozeny[i] == ' ')
cout << " ";
else if (prelozeny[i] == ',')
cout << "--..-- ";
else if (prelozeny[i] == '.')
cout << ".-.-.- ";
else if (prelozeny[i] == '?')
cout << "..--.. ";
else if (prelozeny[i] == '0')
cout << "----- ";
else if (prelozeny[i] == '1')
cout << ".---- ";
else if (prelozeny[i] == '2')
cout << "..--- ";
else if (prelozeny[i] == '3')
cout << "...-- ";
else if (prelozeny[i] == '4')
cout << "....- ";
else if (prelozeny[i] == '5')
cout << "..... ";
else if (prelozeny[i] == '6')
cout << "-.... ";
else if (prelozeny[i] == '7')
cout << "--... ";
else if (prelozeny[i] == '8')
cout << "---.. ";
else if (prelozeny[i] == '9')
cout << "----. ";
else if (prelozeny[i] == 'A' || prelozeny[i] == 'a')
cout << ".- ";
else if (prelozeny[i] == 'B' || prelozeny[i] == 'b')
cout << "-... ";
else if (prelozeny[i] == 'C' || prelozeny[i] == 'c')
cout << "-.-. ";
else if (prelozeny[i] == 'D' || prelozeny[i] == 'd')
cout << "-.. ";
else if (prelozeny[i] == 'E' || prelozeny[i] == 'e')
cout << ". ";
else if (prelozeny[i] == 'F' || prelozeny[i] == 'f')
cout << "..-. ";
else if (prelozeny[i] == 'G' || prelozeny[i] == 'g')
cout << "--. ";
else if (prelozeny[i] == 'H' || prelozeny[i] == 'h')
cout << ".... ";
else if (prelozeny[i] == 'I' || prelozeny[i] == 'i')
cout << ".. ";
else if (prelozeny[i] == 'J' || prelozeny[i] == 'j')
cout << ".--- ";
else if (prelozeny[i] == 'K' || prelozeny[i] == 'k')
cout << "-.- ";
else if (prelozeny[i] == 'L' || prelozeny[i] == 'l')
cout << ".-.. ";
else if (prelozeny[i] == 'M' || prelozeny[i] == 'm')
cout << "-- ";
else if (prelozeny[i] == 'N' || prelozeny[i] == 'n')
cout << "-. ";
else if (prelozeny[i] == 'O' || prelozeny[i] == 'o')
cout << "--- ";
else if (prelozeny[i] == 'P' || prelozeny[i] == 'p')
cout << ".--. ";
else if (prelozeny[i] == 'Q' || prelozeny[i] == 'q')
cout << "--.- ";
else if (prelozeny[i] == 'R' || prelozeny[i] == 'r')
cout << ".-. ";
else if (prelozeny[i] == 'S' || prelozeny[i] == 's')
cout << "... ";
else if (prelozeny[i] == 'T' || prelozeny[i] == 't')
cout << "- ";
else if (prelozeny[i] == 'U' || prelozeny[i] == 'u')
cout << "..- ";
else if (prelozeny[i] == 'V' || prelozeny[i] == 'v')
cout << "...- ";
else if (prelozeny[i] == 'W' || prelozeny[i] == 'w')
cout << ".-- ";
else if (prelozeny[i] == 'X' || prelozeny[i] == 'x')
cout << "-..- ";
else if (prelozeny[i] == 'Y' || prelozeny[i] == 'y')
cout << "-.-- " ;
else if (prelozeny[i] == 'Z' || prelozeny[i] == 'z')
cout << "--.. ";
else
cout << " Spatne zadani \n";
}
cout << " \n";
}