自己写个程序,写一半不会写了,求各位大虾帮忙:
void CGraduationProgramDlg::OnButton2()
{
// TODO: Add your control notification handler code here
CStdioFile file1;
CListBox* pListBox=(CListBox*)GetDlgItem(IDC_LIST1);
//打开文件
if (!file1.Open(m_strFilePath1, CFile::modeRead))
{
::AfxMessageBox(_T("文件打开失败。"));
return;
} //读文件
string key = "",value = "";
string Fbuf[50],Sbuf[50];
while (file1.ReadString(strText1))
{
pListBox->AddString(strText1);
stringstream strSplit((string)strText1);
while (strSplit>>key>>value)
{
trans_map.insert(make_pair(key,value));
}
}
file1.Close();
}
这个函数是一个读取按钮的,读取txt文档后按行读,判断每2行之间不同的地方,并且把这一前一后2个不同的字符串保存到哈希表中,判断部分不会写,高手们帮帮忙把!仅剩的20分了
void CGraduationProgramDlg::OnButton2()
{
// TODO: Add your control notification handler code here
CStdioFile file1;
CListBox* pListBox=(CListBox*)GetDlgItem(IDC_LIST1);
//打开文件
if (!file1.Open(m_strFilePath1, CFile::modeRead))
{
::AfxMessageBox(_T("文件打开失败。"));
return;
} //读文件
string key = "",value = "";
string Fbuf[50],Sbuf[50];
while (file1.ReadString(strText1))
{
pListBox->AddString(strText1);
stringstream strSplit((string)strText1);
while (strSplit>>key>>value)
{
trans_map.insert(make_pair(key,value));
}
}
file1.Close();
}
这个函数是一个读取按钮的,读取txt文档后按行读,判断每2行之间不同的地方,并且把这一前一后2个不同的字符串保存到哈希表中,判断部分不会写,高手们帮帮忙把!仅剩的20分了
解决方案 »
- VS2005如何引用外部库.
- MFC socket StarServer 怎样可以创建多个客户端
- solidworks中SelectByID函数的使用
- CTreeView: 1)如何在某个 item 下没有孩子,其前出现"+"加号, 2) 即使在item下没有孩子,点击 "+" 变"-", 点击"-"变"+"
- 各位用 Unicode 这么久了,难道没发现这么简单的一个问题么?
- 现在搞VC工资到底高到多少低到多少??
- *************如何将包含多个类(MFC)的应用程序封装成DLL?(信誉良好)
- 编译原理--哪里由讲编译原理的VCD教学,或者更好的学习方法
- 帮我看看错在那里?谢谢!
- 怎样在CTatusBar上Create一个CWnd并可以方便的对这个CWnd进行控制。。。(抢答!)
- 正则表达式贴:请教微软Greta的换行方法
- MFC中的串口编程求助(关于MsComm控件的使用)!!!
He am an student
He is an student
He is a student
我要做的就是提取这3句话中的2个字符串对:
He am an==>He is an
He is an==>He is a
就是每相邻2句话中不同的部分加上他们各自前面和后面的一个词