| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1264 人关注过本帖
标题:程序运行出问题,帮忙解决下啊
只看楼主 加入收藏
morose2004
Rank: 1
等 级:新手上路
帖 子:17
专家分:0
注 册:2011-5-11
结帖率:66.67%
收藏
 问题点数:0 回复次数:3 
程序运行出问题,帮忙解决下啊
我把书上的程序打了一遍想运行下看有什么结果,编译链接时都没有错误就是在运行时,系统“嘣”的响了一声,弹了个框,debug error:Debug Error!

Program: C:.......hahaha.exe

R6010

-abort() has been called

 

Press Retry to debug the application...

程序肯定没有问题我照书上抄的,我也没有打错,不过我还是把程序贴出来吧,感觉应该和程序没有关系
#include<iostream>
#include<fstream>
#include<sstream>
#include<list>
#include<string>
#include<vector>
#include<utility>
#include<map>
using namespace std;
int main(int argc,char**argv)
{
 map<string,string>trans_map;
 string key,value;
 if(argc!=3)
 throw runtime_error("wrong number of arguments");
 ifstream map_file;
 ifstream& open_file(ifstream& in,const string &file);
 if(!open_file(map_file,argv[1]))
 {
 throw runtime_error("no transformation file");
 }
 while(map_file>>key>>value)
 trans_map.insert(make_pair(key,value));
 ifstream input;
 if(!open_file(input,argv[2]))
 throw runtime_error("no input file");
 string line;
 while(getline(input,line))
 {
 istringstream stream(line);
 string word;
 bool firstword=true;
 while(stream>>word)
 {
 map<string,string>::const_iterator map_it=trans_map.find(word);
 if(map_it!=trans_map.end())
 word=map_it->second;
 if(firstword)
 firstword=false;
 else
 cout<<" ";
 cout<<word;
 }
 cout<<endl;
 }
 return 0;
}
ifstream& open_file(ifstream& in,const string &file)
{
 in.close();
 in.clear();
 in.open(file.c_str());
 return in;
}
搜索更多相关主题的帖子: include called 
2011-07-10 18:31
杰仔1997
Rank: 2
来 自:广东
等 级:论坛游民
帖 子:41
专家分:31
注 册:2011-6-2
收藏
得分:0 
路过
2011-07-10 21:15
lai0301
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2010-2-17
收藏
得分:0 
在project菜单里设置工作目录 跟程序变量,如你要读取的文件在F盘,在工作目录写F:\,程序变量写你读取的文件名,例如你的文件名叫1.txt和2.txt则在程序变量一栏写1.txt 2.txt(文件名中间用空格)如果你程序保存位置跟读取文件位置在同一目录,则工作目录可以省略,只设置程序变量即可!
2011-07-11 02:43
lai0301
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2010-2-17
收藏
得分:0 
protect 菜单点设置然后点Debug,嘿嘿。。。。
2011-07-11 02:46
快速回复:程序运行出问题,帮忙解决下啊
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.014956 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved