标题:这个小程序怎么改 谢谢
取消只看楼主
yanpeisen
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2008-7-4
 问题点数:0 回复次数:0 
这个小程序怎么改 谢谢
#include <iostream.h>

class Tdate
{
    public:
        void set(int m,int d, int y)
        {
            month=m;  day=d;  year=y;
        }
        int Isleapyear()
       {
            return(year%4==0&&year%100!=0)||(year%400==0);
        }
        void print()
        {
            cout<<month<<"/"<<day<<"/"<<year<<endl;
        }
    private:
        int month;  int day;  int year;
}
void main()                    [bo]错误在这  [/bo]  //Tdate' followed by 'void' is illegal (did you forget a ';'?)
{
    Tdate a;
    a.set(10,1,1949);
    a.print();
    if(a.Isleapyear)
        cout<<"It is a leap year!"<<endl;
    else
        cout<<"It is not a leap year!"<<endl;
}
搜索更多相关主题的帖子: private include public return 
2008-11-01 00:36



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-241785-1-1.html




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

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