急急急!!明天考试!懂c++的进

[复制链接]
查看11 | 回复3 | 2011-1-12 07:31:44 | 显示全部楼层 |阅读模式
3. 写出程序运行的结果
#include
class Time { char a[9];

int hours;

int minutes;

int senconds;
public:
Time(int s=0, int m=0, int h=0){
hours=h;
minutes=m;
seconds=s;
}
void show( ){
cout 60)
{temp.senconds = temp.seconds - 60;temp.minutes++; }
if(temp.minutes > 60){ temp.minutes = temp.minutes - 60; temp.hours++;}
if(temp.hours >=24) temp.hours = temp.hours - 24;
return temp;
}
void main( )
{
Time T, T1(20, 23, 21), T2(10, 25, 15), T3(5, 10, 15);
T = T1 + T2;
T.show( );
T = T1 + T3;
T.show( );
}
答:
4. 阅读下面程序,回答题后的问题
//************************************************
#include
class A {
private:

//…其他成员

static int object_count;
public:
A(){A::object_count++;}
A~{ A::object_count--;}
int GetObjectCount(){return A::object_count;}

virtualvoid func(int data) { cout>choice[0];
cout>choice[1];
cout>choice[2];
cout<<"请给出你抽到的第四牌:";
cin&g
回复

使用道具 举报

千问 | 2011-1-12 07:31:44 | 显示全部楼层
3.时间:12:48:30时间:12:33:254.class B:1class A:haha不正确。基类都没有func()。
回复

使用道具 举报

千问 | 2011-1-12 07:31:44 | 显示全部楼层
大哥,这样的问题还拿来问,自己运行一下不行啊
回复

使用道具 举报

千问 | 2011-1-12 07:31:44 | 显示全部楼层
正确
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行