I need a program that switchs letters into other letters and i don't know how to make the letters switch please help.
Printable View
I need a program that switchs letters into other letters and i don't know how to make the letters switch please help.
Do you mean encrypting the text? If so, just define your key (the encryption/decryption code) then write a function that reads through a string character by character, runs the character against the key to change it then write it out to the encrypted string.
no it's like a translator but in to a langauge i made.
The idea is you type the Enlish in one box "IDC_EDIT_SECOND"
and it come out in the other langauge in box "IDC_EDIT_SHOW"
here is the code
Code:
void CReversDlg::OnChangeEditSecond()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
// TODO: Add your control notification handler code here
CEdit* pEdit = (CEdit*)GetDlgItem(IDC_EDIT_SECOND);
CEdit* pEditShow = (CEdit*)GetDlgItem(IDC_EDIT_SHOW);
CString strText;
pEdit->GetWindowText(strText);
//switch letter's in strText here
//
pEditShow->SetWindowText(strText);
}
Basically the same method I mentioned above will apply but with slight modifications. Define your a dictionary of your custom language with an array or linked list. When you need to translate the english to your language read their text (word by word) into a temp string. Use strcmp to find a match (or if you want to allow for spelling corrections - find the closest match). Once you find it write the match into a new string. For each word to be translated, concatenate the new translated word onto the former ones. When you've finished output the new translated string into the edit box.
If you're looking for speed you will want to tinker with the string parser (the strcmp part) so that it first checks the first initial, then the 2nd, and so on. ie: if the word starts with a "d", then until a match is found only search entries in your dictionary that start with a "d", etc. etc.