致命的例外 [英] A fatal exception

查看:79
本文介绍了致命的例外的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

致命异常0E发生在0028:C027B6DC在VXD VWIN32(04)+00001088。

当前申请将被终止。


相同在DOS下运行的程序不会崩溃。

#include< iostream>

#include< iomanip>


int numb_cities = 0;

const int MAX = 120;


class Cities {

private:

char cityname [MAX] [MAX]; // 120个城市的数组。

int temp [MAX];


public:

Cities();

void output();

};


Cities :: Cities()

{

char y_n;

do {

cout<<" \ n\ n";

cout<<"请输入城市名称:" ;;

cin>> cityname [numb_cities];

cout<< ;" \ n请输入temp:" ;;

cin>> temp [numb_cities];

numb_cities ++;

cout<< ; \ n \\ n另一个城市?(Y / N)&qu ot ;;

cin>> y_n;

} while(y_n ==''y''|| y_n ==''Y'');

cout<<" \ n\ n";

}


void Cities :: output()

{

cout<<" \ n"<<"" city of city"

<<"温度

<<" \ n" ;;

for(int t = 0; t< numb_cities; t ++)

{

cout<< setw(5)<< cityname [t]<< setw(15)<< temp [t]<<" \ n" ;;

}

} //关闭输出


int main()

{

城市信息;

info.output();

返回0;

}


-------------------------------------------- ------

***电子邮件被关闭***

---------------- ----------------------------------

A fatal exception 0E has occurred at 0028:C027B6DC in VXD VWIN32(04)+00001088.
The current application will be terminated.

Same program below run in DOS does not crash.
#include<iostream>
#include<iomanip>

int numb_cities=0;
const int MAX = 120;

class Cities {
private:
char cityname[MAX][MAX];//an array of 120 cities.
int temp[MAX];

public:
Cities();
void output();
};

Cities:: Cities()
{
char y_n;
do{
cout<<"\n\n";
cout<<"Please enter name of city: ";
cin>>cityname[numb_cities];
cout<<"\nPlease enter temp: ";
cin>>temp[numb_cities];
numb_cities++;
cout<<"\nAnother city?(Y/N)";
cin>>y_n;
}while(y_n ==''y'' || y_n ==''Y'');
cout<<"\n\n";
}

void Cities::output()
{
cout<<"\n"<<"name of city"
<<" temperature"
<<"\n";
for(int t=0;t<numb_cities;t++)
{
cout<<setw(5)<<cityname[t]<<setw(15)<<temp[t]<<"\n";
}
}//close output

int main()
{
Cities info;
info.output();
return 0;
}

--------------------------------------------------
*** E-mail is shut off ***
--------------------------------------------------

推荐答案



" Developwebsites" <德************* @ aol.com>在留言新闻中写道:20 *************************** @ mb-m05.aol.com ...

"Developwebsites" <de*************@aol.com> wrote in message news:20***************************@mb-m05.aol.com...

int numb_cities = 0;


如果你要使用它来为什么这是一个全局变量

计算cityname输入单个对象的数量。 />
如果您有多个City对象,则不会使用

来工作。

char cityname [MAX] [MAX]; //一个由120个城市组成的阵列。

int numb_cities=0;
Why is this a global variable if you are going to use it to
count the number of cityname''s input into a single object.
If you ever have more than one City object, this is not going
to work.
char cityname[MAX][MAX];//an array of 120 cities.




你对字符串有什么看法?


但是所有这一切,我都不知道我不知道它崩溃的原因....

你试过一个调试器。



What do you have against strings?

But all that being said, I don''t know why it crashes....
Did you try a debugger.


在文章< 20 ****** *********************@mb-m05.aol.com>,

Developwebsites< de ******* ******@aol.com>写道:
In article <20***************************@mb-m05.aol.com>,
Developwebsites <de*************@aol.com> wrote:
致命异常0E发生在0028:V0D VWIN32(04)+00001088中的C027B6DC。
当前应用程序将被终止。
A fatal exception 0E has occurred at 0028:C027B6DC in VXD VWIN32(04)+00001088.
The current application will be terminated.




您使用了什么输入?当您输入城市名称时,程序是否立即崩溃或者是否崩溃了,或者当您输入温度时它是否崩溃或者当您输入Y或者是
时N?


我能想到程序可能会崩溃的几个原因,但是你没有给出足够的信息以确定它是哪一个b $ b是。


您是否尝试过使用调试器?您是否尝试将跟踪语句放在

代码中以找出出现了什么问题?你知道哪条线导致

问题吗?


艾伦

-

Defendit numerus



What input did you use? Did the program crash immediately or did it crash when
you entered in the city name or was it when you entered in the temperature or
was it when you entered in Y or N?

I can think of a couple of reasons why the program might crash, but you haven''t
given enough information to determine which one it is.

Have you tried using a debugger? Have you tried putting trace statements in the
code to figure out what is going wrong? Do you know which line is causing the
problem?

Alan
--
Defendit numerus


>您使用了什么输入?该程序是否立即崩溃或者是否崩溃
>What input did you use? Did the program crash immediately or did it crash




程序编译但是当我试图运行它时崩溃了;没有机会输入输入。

------------------------- -------------------------

***电子邮件被关闭***

----------------------------------------------- ---



the program compiled but crashed right when I tried to run it; did not have a
chance to enter input.
--------------------------------------------------
*** E-mail is shut off ***
--------------------------------------------------


这篇关于致命的例外的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆