2 julywin julywin 于 2014.11.01 20:47 提问

程序运行时总是出现这个Process terminated with status -1073741510,求大神来帮帮忙

safearray.h文件
#ifndef SAFEARRAY_H
#define SAFEARRAY_H

#include

template
class safearray {

private:
T* storage;
int capacity;

public:
safearray() : storage(NULL), capacity(0) {} // default constructor
safearray(const safearray& c){
capacity=c.capacity;
storage=new T;
storage=(c.storage);
};
safearray(int); // single param constructor
~safearray(void); // destructor
T& operator throw(out_of_range);
};
template
safearray::safearray(int i):capacity(i),storage(new T[i])
{}

template
safearray::~safearray()
{
delete [] storage;
}

template
T& safearray::operator throw(out_of_range)
{
if(i(capacity-1)){
out_of_range e("The index is out of range of array");
throw e;
}else
return storage[i];
}

#endif

course头文件

#ifndef COURSE_H
#define COURSE_H
#include "safearray.h"

const int MAX_LINES = 10;

class course {

public:
string name;
string title;
//string description[MAX_LINES];
safearray description;

course()
{
    name="";
    title="";
    description=safearray<string>(MAX_LINES);
}
course(string name, string title)
{
    name=name;
    title=title;
    description=safearray<string>(MAX_LINES);
}
friend ostream& operator<<(ostream&,const course&);
friend istream& operator>>(istream&, course&);

};

ostream& operator<<(ostream& out, course& c) {

out << c.name << ": " << c.title << "\n";

int index = 0;
while (c.description[index] != "") {
    out << c.description[index++] << "\n";
}

return out;

}

istream& operator>>(istream& in, course& c) {

getline(in, c.name);
getline(in, c.title);

string line;
getline(in, line);
int number = 0;
while (line != "") {
    c.description[number++] = line;
    getline(in, line);
}
return in;

}

#endif

main.cpp

// For Visual C++ users:
// Visual C++ does not implement checked exceptions, and the compiler will
// show warning messages when functions throws exceptions. The following
// warning pragma ignore those compiler messages.
//
// GCC users can remove this #pragma warning.
#pragma warning(disable: 4290)

#include
#include
#include
#include

using namespace std;

#include "course.h"
#include "safearray.h"

void init_courses(safearray&);
void display_menu(safearray);

const int NUM_COURSES = 10;
const int QUIT = 99;

int main(int argc, char* argv[]) {

safearray<course> courses(NUM_COURSES);
init_courses(courses);

int choice = 0;
while (choice != QUIT) {

    display_menu(courses);
    cout << "Enter number of course to see more information on\n";
    cin >> choice;
    cout << "\n";

    if (choice >= 1 && choice <= NUM_COURSES) {
        cout << courses[choice - 1] << "\n\n";
    }
}

return EXIT_SUCCESS;

}

void display_menu(safearray courses) {
for (int i = 1; i <= NUM_COURSES; i++) {
cout << i << ". " << courses[i - 1].name << "\n";
}
cout << "99. Quit\n";
}

void init_courses(safearray& courses) {
ifstream inf("courses.txt");
if (! inf) {
cerr << "Could not open courses.txt" << endl;
exit(EXIT_FAILURE);
}
for (int i = 0; i < NUM_COURSES; i++) {
inf >> courses[i];
}

inf.close();

}

求大神来帮帮忙,

2个回答

longtengxinglen
longtengxinglen   2015.04.05 16:56

又是Code::Blocks,老显示Process terminated with status -1073741510,今天查了一下。

-1073741510就是0xC000013A,也就是STATUS_CONTROL_C_EXIT。

应该是运行中按CTRL+C终止程序运行时返回这个值。

However this exit code simply means that the CMD Prompt Windows was closed during execution of the script.

表示命令窗口在程序执行过程中被关闭。

longtengxinglen
longtengxinglen   2015.04.05 16:57
Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!
其他相关推荐
process terminated with status 255 in codeblocks
我的问题是没有装xterm yum install xterm 解决
CodeBlocks C1041
DlgExternalIP.cpp: fatal error C1041: 无法打开程序数据库“D:\codeblocks\Workspace\Demo-PortForward\vc140.pdb”;如果要将多个 CL.EXE 写入同一个 .PDB 文件,请使用 /FS Process terminated with status 2 (0 minute(s), 0 second(s)) Dl...
Process terminated with status -1073741510
<br />又是Code::Blocks,老显示Process terminated with status -1073741510,今天查了一下。<br /> <br />-1073741510就是0xC000013A,也就是STATUS_CONTROL_C_EXIT。<br /><br />应该是运行中按CTRL+C终止程序运行时返回这个值。<br /><br />However this exit code simply means that the CMD Prompt Windows was cl
Designer process terminated unexpectedly 问题的解决方法
安装Visual Studio 11 Beta后, 尝试建立一个新应用(C#),打开BlankPage.xaml时设计器中出现如下所示的错误。(另外:我第一次安装的是VS11中文版,出现了这样的错误,后来卸载后又装了一个英文版还是出现了这样的错误。) System.Runtime.Remoting.RemotingException [3512] Designer process termin
centos6.8启动错误 init: rcS post-stop process terminated with status 1
前段时间在一台虚拟机上做监控软件测试,但重启后不知道怎么就启动不了,刚启动不久就提示init:rcS post-stop process (870) terminated with status 1 错误如下   查了很多资料都没有找到原因,后来有一个网友的提醒,说可能是/etc/rc.d/ 目录下的某个文件有问题。可我没有修改过下面的任何文件啊。不管了,
Process terminated with status 255 错误,首先检查错误
网上解决方法多是: https://community.linuxmint.com/tutorial/view/1597 但是实际情况却是 http://tieba.baidu.com/p/2399514771 ,后来看到这, http://zhidao.baidu.com/question/491458640.html,不屑一顾,心想我怎么能写错,更何况是抄的。。。
Qt 程序编译时提示:The CDB process terminated
Qt 程序debug时提示:The CDB process terminated 原因是生成可执行文件中相关的缺少动态库文件,找到可执行文件双击看提示添加dll文件;
the CDB process terminated
在调试qt的时候,出现了the CDB process terminated 。 首先,要确定qt creator的配置是对的。 1、qt的环境变量的设置 2、在qt creator 中的工具 -> 选项 ->构建和运行,要确定这些选项配置对。 1)安装windbgd 32位,64位的安装 2)qt 版本的设置 3)Kit 页面的设置 3 这个
Linux显示系统的诊断信息
Linux显示系统的诊断信息 youhaidong@youhaidong-ThinkPad-Edge-E545:~$ dmesg [ 1.492480] EDD information not available. [ 1.492521] PM: Hibernation image not present or could not be loaded. [ 1.506
qt opencv 出现the cdb process terminated
这个错误一般是动态链接库加载失败导致的。 我当时已经配置了环境变量,但是有由于环境变量的配置在QT启动之后,所以QT没有加载新配置的环境变量。 解决方法:重启QT