c++高手帮忙看看这个程序

来源:百度知道 编辑:UC知道 时间:2024/05/21 01:30:15
#include "stdafx.h"
#include <iostream>
using namespace std;
class Date
{
int year;
int month;
int day;
public:
Date(int Year,int Month,int Day)
{
year=Year;month=Month;day=Day;
}
void show()
{
cout<<year<<":"<<month<<":"<<day<<endl;
}
};
class Tame
{
int hour;
int min;
int s;
public:
Tame(int Hour,int Min,int S)
{
hour=Hour;min=Min;s=S;
}
void show()
{
cout<<hour<<":"<<min<<":"<<s<<endl;
}

};
int main()
{
Date d(2009,4,12);
d.show();
Tame t(10,25,30);
t.show();
}

这个程序我用 Visual Studio 2005 运行结果弹出来一下就没有了 怎么回事啊 怎么解决

如果真的是这个原因的话
你可以再main()函数里面的return 之前或者最后一行。 加上system("pause");

在main函数的最后插入system("PAUSE");

在main最后加一个getchar();

很正常了,,按Ctrl+F5,,运行完会停下来

我运行都没有什么问题 的!