Created
July 9, 2020 06:35
-
-
Save BMU-Verlag/5c662bff34c8bca57a9702cc7e57820e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <windows.h> | |
#include <string.h> | |
using namespace std; | |
int main(int argc, char *argv[]) | |
{ | |
char grossbuchstaben[42] = " ABCDEFGHIJKLMNOPQRSTUVWXYZ\216\231\232\3411234567890"; | |
char kleinbuchstaben[42] = " abcdefghijklmnopqrstuvwxyz\204\224\201\3411234567890"; | |
string morsezeichen[41] = {" ", ".-", "-...", "-.-.", "-..", ".", "..-.", "--.", "....", "..", | |
".---", "-.-", ".-..", "--", "-.", "---", ".--.", "--.-", ".-.", "...", "-", "..-", "...-", | |
".--", "-..-", "-.--", "--..", ".-.-", "---.", "..--", "...--..", ".----", "..---", "...--", | |
"....-", ".....", "-....", "--...", "---..", "----.", "-----"}; | |
string eingabe; | |
string ausgabe = ""; | |
cout << "Geben Sie den Text ein, den Sie \201bersetzen wollen:\n"; | |
getline(cin, eingabe); | |
int i; | |
for(i = 0; i < eingabe.length(); i++){ | |
int j = 0; | |
bool weiter = true; | |
while(weiter && j < 42){ | |
if(grossbuchstaben[j] != eingabe[i] && kleinbuchstaben[j] != eingabe[i]){ | |
j++; | |
} | |
else{ | |
weiter = false; | |
} | |
} | |
if (j < 42){ | |
ausgabe += morsezeichen[j] + " "; | |
} | |
} | |
cout << ausgabe; | |
for(i = 0; i < ausgabe.length() - 1; i++){ | |
if(ausgabe[i] == '.'){ | |
Beep(600,500); | |
} | |
else if(ausgabe[i] == '-'){ | |
Beep(600,1000); | |
} | |
else if(ausgabe[i] == ' '){ | |
Sleep(1000); | |
} | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment