| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 384 人关注过本帖
标题:求解为什么time1出错?
取消只看楼主 加入收藏
henhenlu
Rank: 1
等 级:新手上路
帖 子:3
专家分:1
注 册:2013-11-2
结帖率:100%
收藏
已结贴  问题点数:20 回复次数:1 
求解为什么time1出错?
#include<iostream>
using namespace std;
class Time
{
      public:
             Time(int hour=0,int min=0,int sec=0);
             int compute();
      
                     int hour;
                     int min;
                     int sec;
                     };
                     Time::Time(int h,int m,int s)
                     {
                                    hour=h;
                                    min=m;
                                    sec=s;
                                    }
                                    int Time::compute()
                                    {
                                        return(hour*min*sec);
                                        }
                                        int main()
                                        {
                                            Time time1();
                                            cout<<"The hour is:"<<time1.hour<<endl;
                                            Time time2(6,2,4);
                                            cout<<"The hour is:"<<()<<endl;
                                            Time time3(1,2,3);
                                            cout<<"The hour is:"<<()<<endl;
                                       system("pause");
                                            }
搜索更多相关主题的帖子: include public 
2013-11-02 13:54
henhenlu
Rank: 1
等 级:新手上路
帖 子:3
专家分:1
注 册:2013-11-2
收藏
得分:0 
您说的有道理啊
2013-11-03 12:23
快速回复:求解为什么time1出错?
数据加载中...
 
   



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

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