| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1057 人关注过本帖
标题:[求助]程序问题,没见过这种错误,请指教
取消只看楼主 加入收藏
wfpb
Rank: 6Rank: 6
等 级:贵宾
威 望:29
帖 子:2188
专家分:0
注 册:2006-4-2
收藏
 问题点数:0 回复次数:2 
[求助]程序问题,没见过这种错误,请指教

我老是忘记上课,所以编写了一个程序,可以有时候看看这个星期是第几周,有什么任务要交,方便一下自己,结果出现下面错误,请指教

错误提示如下:
--------------------Configuration: Noname2 - Win32 Debug--------------------
Compiling...
Noname2.cpp
D:\Documents and Settings\Administrator\桌面\王飞\查询课程第几周\Noname2.cpp(12) : fatal error C1001: INTERNAL COMPILER ERROR
(compiler file 'msc1.cpp', line 1786)
Please choose the Technical Support command on the Visual C++
Help menu, or open the Technical Support help file for more information
Error executing cl.exe.

程序源码如下:
#include <iostream>
using namespace std;

class Date
{
int ye,mo,da;
int m[12];
bool isLeapYear(int num){return (num%400==0)||((num%4==0)&&(num%100!=0));}
public:
Date(int c,int a,int b):ye(c),mo(a),da(b){m[]={31,28,31,30,31,30,31,31,30,31,30,31};if(isLeapYear(c))m[1]=29;}
friend int operator-(Date m,Date n)
{
int total=0;
for(int i=m.mo-1;i<n.mo;i++)all+=m[i];
all+(n.da-m.da);
return total;
}
friend int weekth(Date &m,Date &n)
{
int days=n-m;
return days/7+1;
}
};
int main()
{
ifstream ins("date.txt");
int y1,y2,m1,m2,d1,d2;
if(!ins)
{
do
{
cout<<"输入开学日期(月,日):";
cin>>setw(4)>>y1>>setw(2)>>m1>>setw(2)>>d1;
if(y1<=2005||y1>=2008||m1<=0||m1>=13||da<=0||da>=31)continue;
ofstream ous("date.txt");
ous<<y1<<" "<<m1<<" "<<d1;
ous.close();
}while(y1<=2005||y1>=2008||m1<=0||m1>=13||da<=0||da>=31);
}
else
{
ins>>y1>>m1>>d1;ins.close();
}
Date term(y1,m1,d1);
cout<<"输入今天的日期";
cin>>setw(2)>>m2>>setw(2)>>d2;
Date now(y2,m2,d2);
int weekth=weekth(term,now);
cout<<"今天是第 "<<weekth<<"周"<<endl;
system("pause");
return 0;
}

搜索更多相关主题的帖子: 指教 
2006-06-08 13:07
wfpb
Rank: 6Rank: 6
等 级:贵宾
威 望:29
帖 子:2188
专家分:0
注 册:2006-4-2
收藏
得分:0 

我喜欢在编译中找错误,所以只用了10几分钟编写的,2楼指出的错误是全部吗?


[glow=255,red,2]wfpb的部落格[/glow] 学习成为生活的重要组成部分!
2006-06-08 13:54
wfpb
Rank: 6Rank: 6
等 级:贵宾
威 望:29
帖 子:2188
专家分:0
注 册:2006-4-2
收藏
得分:0 

但是我的VC6的盘上面写了SP6啊~?


[glow=255,red,2]wfpb的部落格[/glow] 学习成为生活的重要组成部分!
2006-06-09 14:39
快速回复:[求助]程序问题,没见过这种错误,请指教
数据加载中...
 
   



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

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