char input;
int i;
string morse;
cout << "Insert morsecode to translate it ( c):\n";
/* This program check every character individually with cin.get() */
cin.get(input);
while(!cin.eof()){
/* Check if character isa good input */
if (input!= ' ' && input!= '-' && input!= '.' && input!= '\n'){
cout << "(Wrong input)";
return 0;
}
/* It checks if input is good ".--" and then morse is one letter of MORSECODE */
while ( (input != ' ' && input !='\n') && (input=='-'||input == '.')){
morse= morse+ input;
cin.get(input);
}
/*Here it checks If the MOESECODE we found above is one letter from the array with the alphabet */
for(i=0;i<37;i++){
if( morse==morarr[i]){
cout << alpha[i] ;
}
}
/* From here it checks again different character situations */
if(input == ' '){
cin.get(input);
}