| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 734 人关注过本帖
标题:【初学者求助】一个简单的问题
只看楼主 加入收藏
し七月ご
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2007-7-28
收藏
得分:0 

#include<iostream>
using namespace std;
void main ()
{
int year ,int month,int day;
cout<<"Please input the date:\n";

cin>>year>>month>>day;
bool loopyear= (year%4==0&&year%400!=0)||(year%400==0);
int February=(loopyear?29:28);
int whichday;
swich(month)
{
case 1 :whichday=day;break;
case 2 :whichday=31+February;break;
case 3 :whichday=31+February+day;break;
case 4 :whichday=31+February+31+day;break;
case 5 :whichday=31+February+31+30+day;break;
case 6 :whichday=31+February+31+30+31day;break;
case 7 :whichday=31+February+31+30+31+30+day;break;
case 8 :whichday=31+February+31+30+31+30+31+day;break;
case 9 :whichday=31+February+31+30+31+30+31+31+day;break;
case 10 :whichday=31+February+31+30+31+30+31+31+30+day;break;

case 11 :whichday=31+February+31+30+31+30+31+31+30+31+day;break;
case 12 :whichday=31+February+31+30+31+30+31+31+30+31+30+day;break;
}


cout<<"Now the date is :"<<year<<"年"<<month<<"月"<<day<<"日\n"endle;
cout<<"Now this is the"<<whichday<<"day of the year";

}

请教哪有错?

2007-07-29 00:55
快速回复:【初学者求助】一个简单的问题
数据加载中...
 
   



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

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