楼主求助啊
我编写了一个 最简单 的 ///////////////////凯撒密码
为什么 调试时
//点 位移解密 这个按钮的时候 会跳出 这个(图1)
工作界面(图2)


附上 位移加密和 位移解密 (botton2) 这个两个 按钮的代码 。
/*第一个按钮OnButton1() 是绝对正确的 ,就是第二个按钮OnButton2() 为什么错啊?
我是按照第一个按钮的写法写的啊 ?为什么错?*/
/*m_plaintxt代表明文; m_sec代表密文;m_des代表明文解;m_key代表位移;*/
void CShiDlg::OnButton1()
{
UpdateData(TRUE);
m_sec=m_plaintxt;
for(int i=0;i<m_plaintxt.GetLength();i++)
{
if(m_plaintxt.GetAt(i)>='a'&& m_plaintxt.GetAt(i)<='z')
m_sec.SetAt(i,'a'+(m_plaintxt.GetAt(i)-'a'+m_key)%26);
else if(m_plaintxt.GetAt(i)>='A'&& m_plaintxt.GetAt(i)<='Z')
m_sec.SetAt(i,'A'+(m_plaintxt.GetAt(i)-'A'+m_key)%26);
}
UpdateData(FALSE);
}
////////////////////////////////////////////////
void CShiDlg::OnButton2()
{
UpdateData(TRUE);
for(int i=0;i<m_sec.GetLength();i++)
{
if(m_sec.GetAt(i)>='a'&&m_sec.GetAt(i)<='z')
{
if(m_sec.GetAt(i)-'a'>=m_key%26)
m_des.SetAt(i,m_sec.GetAt(i)-m_key%26);
else
m_des.SetAt(i,'z'-(m_key%26-(m_sec.GetAt(i)-'a')-1));
}
else if(m_sec.GetAt(i)>='A'&&m_sec.GetAt(i)<='Z')
{
if(m_sec.GetAt(i)-'A'>=m_key%26)
m_des.SetAt(i,m_sec.GetAt(i)-m_key%26);
else
m_des.SetAt(i,'Z'-(m_key%26-(m_sec.GetAt(i)-'A')-1));
}
}
UpdateData(FALSE);
}I