Zadanie8/kodmorsa.cpp
2024-12-06 23:07:21 +01:00

219 lines
3.4 KiB
C++

#include <iostream>
using namespace std;
void kodowanie(char znak){
switch (znak)
{
case 'A':
cout <<"_. ";
break;
case 'a':
cout <<"_. ";
break;
case 'B':
cout <<"_... ";
break;
case 'b':
cout <<"_... ";
break;
case 'C':
cout << "_._. ";
break;
case 'c':
cout << "_._. ";
break;
case 'D':
cout <<"_.. ";
break;
case 'd':
cout <<"_.. ";
break;
case 'E':
cout <<". ";
break;
case 'e':
cout <<". ";
break;
case 'F':
cout << ".._. ";
break;
case 'f':
cout << ".._. ";
break;
case 'G':
cout << "__. ";
break;
case 'g':
cout << "__. ";
break;
case 'H':
cout << ".... ";
break;
case 'h':
cout << ".... ";
break;
case 'I':
cout << ".. ";
break;
case 'i':
cout << ".. ";
break;
case 'J':
cout << ".___ ";
break;
case 'j':
cout << ".___ ";
break;
case 'K':
cout << "_._ ";
break;
case 'k':
cout << "_._ ";
break;
case 'L':
cout <<"._.. ";
break;
case 'l':
cout <<"._.. ";
break;
case 'M':
cout << "__ ";
break;
case 'm':
cout << "__ ";
break;
case 'N':
cout << "_. ";
break;
case 'n':
cout << "_. ";
break;
case 'O':
cout << "___ ";
break;
case 'o':
cout << "___ ";
break;
case 'P':
cout << ".__. ";
break;
case 'p':
cout << ".__. ";
break;
case 'R':
cout << "._. ";
break;
case 'r':
cout << "._. ";
break;
case 'S':
cout << "... ";
break;
case 's':
cout << "... ";
break;
case 'T':
cout <<"- ";
break;
case 't':
cout <<"- ";
break;
case 'U':
cout << ".._ ";
break;
case 'u':
cout << ".._ ";
break;
case 'V':
cout << "..._ ";
break;
case 'v':
cout << "..._ ";
break;
case 'W':
cout << ".__ ";
break;
case 'w':
cout << ".__ ";
break;
case 'X':
cout << "_.._ ";
break;
case 'x':
cout << "_.._ ";
break;
case 'Y':
cout << "_.__ ";
break;
case 'y':
cout << "_.__ ";
break;
case 'Z':
cout << "__.. ";
break;
case 'z':
cout << "__.. ";
break;
default:
cout <<" ";
break;
}
}
int main(){
string napis_wejsciowy;
cout << "Podaj napis: ";
cin >> napis_wejsciowy;
for(char znak: napis_wejsciowy){
kodowanie(znak);
}
}