求帮助,一上午了没想出办法来。。。 AAABBBBCCDDDDDEEEEEEEEEEaaabbbxxx,以A出现的次数是:3B出现的次数是:4.........x出现的次数是:3 对话框中 以这种格式输出txt,要怎样编程实现。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 for (i=1;i<VecTest.size();i++) { if(VecTest[i]==VecTest[i+1]) { count++; CString strtest; strtest.Format("%f",VecTest[i]); result1=strtest; } else if(VecTest[i]!=VecTest[i+1]) { count=1; } CString NUM; NUM.Format("%d",count); result = result +result1+ "出现的次数:"+"NUM"+ "\r\n"; m_result=result; } 字符是存在一个vectest的数组容器中,上面的哪些地方有问题 for (i=1;i<VecTest.size();i++){ if(VecTest[i]==VecTest[i+1]){ count++;CString strtest;strtest.Format("%f",VecTest[i]);result1=strtest; }else if(VecTest[i]!=VecTest[i+1]){ count=1; } }//这里少了'}'CString NUM; NUM.Format("%d",count); result = result +result1+ "出现的次数:"+"NUM"+ "\r\n"; m_result=result;}把前后文都贴出来吧。加下注释 读取的时候可以用迭代器:char firstChar,vChar;int nCount=0;vector<char>::iterator it=vectest.begin();for (;it!=vectest.end();it++){ if (it==vectest.begin()) { firstChar=*it; nCount++; } else { vChar=*it; if (firstChar==vChar) { nCount++; firstChar=vChar; } else { CString strCount; strCount.Format(L"%d",nCount); MessageBox(strCount); nCount=1; firstChar=vChar; } }} 谁有虚拟打印的例子发一个给我参考以下 谢谢 请问一个资源实例化的问题 关于自动拨号和发email的一个奇怪问题 directshow中怎么得到一个系统已经注册的filters的CLSID? 感谢Panr(光荣)的帮助,请进来接分 我在一个页面中用post方法提交后进入下一页,调用history.back()时提示“网页已过期” 關於文件的全路徑的獲取!! 大家讨论培训???? 用VC++实现探测远程主机是否可达? 奇怪: Skinmagic如何为单个控件换肤(比如单独给按钮换肤) 新手,操作数据库函数的调用
{
if(VecTest[i]==VecTest[i+1])
{
count++;
CString strtest;
strtest.Format("%f",VecTest[i]);
result1=strtest;
}
else if(VecTest[i]!=VecTest[i+1])
{
count=1;
}
CString NUM;
NUM.Format("%d",count);
result = result +result1+ "出现的次数:"+"NUM"+ "\r\n";
m_result=result;
}
for (i=1;i<VecTest.size();i++)
{
if(VecTest[i]==VecTest[i+1])
{
count++;
CString strtest;
strtest.Format("%f",VecTest[i]);
result1=strtest;
}else if(VecTest[i]!=VecTest[i+1])
{
count=1;
} }//这里少了'}'CString NUM;
NUM.Format("%d",count);
result = result +result1+ "出现的次数:"+"NUM"+ "\r\n";
m_result=result;
}
把前后文都贴出来吧。加下注释
char firstChar,vChar;
int nCount=0;
vector<char>::iterator it=vectest.begin();
for (;it!=vectest.end();it++)
{
if (it==vectest.begin())
{
firstChar=*it;
nCount++;
}
else
{
vChar=*it;
if (firstChar==vChar)
{
nCount++;
firstChar=vChar;
}
else
{
CString strCount;
strCount.Format(L"%d",nCount);
MessageBox(strCount);
nCount=1;
firstChar=vChar;
}
}
}