| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 384 人关注过本帖
标题:求解为什么time1出错?
只看楼主 加入收藏
henhenlu
Rank: 1
等 级:新手上路
帖 子:3
专家分:1
注 册:2013-11-2
结帖率:100%
收藏
已结贴  问题点数:20 回复次数:2 
求解为什么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
yuccn
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
来 自:何方
等 级:版主
威 望:167
帖 子:6815
专家分:42393
注 册:2010-12-16
收藏
得分:20 
你输出是什么?你期待的是什么?

楼主,缩进太难看了

我行我乐
公众号:逻辑客栈
我的博客:
https://blog.yuccn. net
2013-11-02 23:19
henhenlu
Rank: 1
等 级:新手上路
帖 子:3
专家分:1
注 册:2013-11-2
收藏
得分:0 
您说的有道理啊
2013-11-03 12:23
快速回复:求解为什么time1出错?
数据加载中...
 
   



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

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