问答文章1 问答文章501 问答文章1001 问答文章1501 问答文章2001 问答文章2501 问答文章3001 问答文章3501 问答文章4001 问答文章4501 问答文章5001 问答文章5501 问答文章6001 问答文章6501 问答文章7001 问答文章7501 问答文章8001 问答文章8501 问答文章9001 问答文章9501

用C语言编写万年历系统

发布网友 发布时间:2022-05-07 07:48

我来回答

3个回答

热心网友 时间:2023-11-02 08:17

必须在TC2.0才可以使用
/*加载头文件*/
#include <stdio.h>
#include <bios.h>
#include <dos.h>
#include <conio.h>

/*定义常量*/
/*左移键*/
#define LEFT 0x4b00
/*右移键*/
#define RIGHT 0x4d00
/*下移键*/
#define DOWN 0x5000
/*上移键*/
#define UP 0x4800
/*向上翻页移键*/
#define PAGEUP 0x4900
/*向下翻页移键*/
#define PAGEDOWN 0x5100
/*小写字母q*/
#define QLOWER 0x1071
/*大写字母Q*/
#define QUPPER 0x1051
/*空格键*/
#define SPACE 0x3920
/*Escape键*/
#define ESC 0x011b

/*定义全局变量*/
struct date sysTime;
int currentYear;
int currentMonth;
int currentDay;
int n_currentMon;
int n_lastMon;

/*-----------自定义函数-------------------------*/
void checkDate();
int isLeapyear(int year);
int getWeek(int year,int month,int day);

void printSpace(int n);
void printSeparator();
void printUsage();
void printWeek();
void printWeek2(int week);

void showCalendar(int year,int month,int day);

void getKeyValue();
/*--------------------------------------------*/

/*检查日期有效性函数*/
void checkDate()
{
/*如果给定的日期中年份部分为负数或者0*/
if(currentYear<=0)
{
gotoxy(1,27);
printf("The year should be a positive number !\n");
gotoxy(1,28);
printf("Press any key to continue......");
getchar();
getchar();
/*以当前系统时间重新赋值*/
currentYear=sysTime.da_year;
currentMonth=sysTime.da_mon;
currentDay=sysTime.da_day ;
}

/*如果给定的日期中月份部分为负数,为0或者大于12*/
if(currentMonth>12||currentMonth<1)
{
gotoxy(1,27);
printf("The month should be a number between 1 and 12 !\n");
gotoxy(1,28);
printf("Press any key to continue......");
getchar();
getchar();
/*以当前系统时间重新赋值*/
currentYear=sysTime.da_year;
currentMonth=sysTime.da_mon;
currentDay=sysTime.da_day ;
}

/*如果给定的日期中天数部分为负数,为0或者大于31*/
if(currentDay>31||currentDay<1)
{
gotoxy(1,27);
printf("The day should be a number between 1 and 31 !\n");
gotoxy(1,28);
printf("Press any key to continue......");
getchar();
getchar();
/*以当前系统时间重新赋值*/
currentYear=sysTime.da_year;
currentMonth=sysTime.da_mon;
currentDay=sysTime.da_day ;
}
}

/*判断是否是闰年函数*/
int isLeapyear(int year)
{
/*闰年的判断:(1)year被4整除,并且year不被100整除
或(2)year被4整除,并且year被400整除*/
if(year%4==0&&year%100||year%400==0)
return 1 ;
else
return 0 ;
}

/*根据给定日期计算星期函数*/
int getWeek(int year,int month,int day)
{
int leapFlag;
int week;
int i ;
/*该数组用于保存每个月的天数*/
int a[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
int count=0 ;

/*判断给定年份是否是闰年*/
leapFlag=isLeapyear(year);
/*如果是闰年则2月份的日期应该29天*/
if(leapFlag==1)
a[2]++;
/*计算从给定年份的1月1日到给定月份的1号之间的天数*/

for(i=1;i<month;i++)
{
count+=a[i];
}
/*计算从给定年份的1月1日到给定日期之间的天数*/
count+=day;
/*计算星期*/
week=(year+1+(year-1)/4+(year-1)/100+(year-1)/400+count)%7 ;
return week ;
}

/*输出指定个数个空格函数*/
void printSpace(int n)
{
int i ;
for(i=0;i<n;i++)
printf(" ");
}

/*输出分隔线函数*/
void printSeparator()
{
int i ;
for(i=0;i<38;i++)
{
printf("=");
}
printf("\n");
}

/*输出使用方法函数*/
void printUsage()
{
gotoxy(45,3);
/*设定字体颜色*/
textcolor(YELLOW);
/*送格式化输出至屏幕*/
cprintf("-----------Usage-----------");

gotoxy(45,5);
textcolor(YELLOW);
cprintf("YEAR");
gotoxy(50,5);
printf(" Up key( ) to increase;\n");
gotoxy(50,7);
printf(" Down key( ) to decrease.\n");

gotoxy(45,9);
textcolor(YELLOW);
cprintf("MONTH:");
gotoxy(50,9);
printf(" Right key( ) to increase;\n");
gotoxy(50,11);
printf(" Left key( ) to decrease.\n");

gotoxy(45,13);
textcolor(YELLOW);
cprintf("DAY");
gotoxy(50,13);
printf(" PageDown key to increase;\n");
gotoxy(50,15);
printf(" PageUp key to decrease.\n" );

gotoxy(45,17);
textcolor(YELLOW);
cprintf("QUERY");
gotoxy(50,17);
printf(" Q/q key\n");

textcolor(YELLOW);
gotoxy(45,19);
cprintf("RESET");
gotoxy(50,19);
printf(" SPACE key.\n");

gotoxy(45,21);
textcolor(YELLOW);
cprintf("EXIT");
gotoxy(50,21);
printf(" Esc key\n");

gotoxy(59,5);
/*设置寄存器,表示在指定位置输出一次指定的字符*/
_CX=01;
_AH=0xa;
/*指定输出字符为向上的箭头*/
_AL=24;
/*产生一次中断,输出向上的箭头*/
geninterrupt(0x10);

gotoxy(61,7);
_CX=01;
_AH=0xa;
/*指定输出字符为向下的箭头*/
_AL=25;
geninterrupt(0x10);

gotoxy(62,9);
_CX=01;
_AH=0xa;
_AL=26;
/*指定输出字符为向右的箭头*/
geninterrupt(0x10);

gotoxy(61,11);
_CX=01;
_AH=0xa;
/*指定输出字符为向左的箭头*/
_AL=27;
geninterrupt(0x10);
/*还原字体颜色*/
textcolor(7);
}

/*根据系统日期输出星期函数*/
void printWeek()
{
int day ;
/*根据系统日期获得星期*/
day=getWeek(currentYear,currentMonth,currentDay);
textcolor(11);

/*输出星期,0表示星期天,1表示星期一......6表示星期六*/
if(day==0)
cprintf("%d-%d-%d,Sunday!",currentYear,currentMonth,currentDay);
if(day==1)
cprintf("%d-%d-%d,Monday!",currentYear,currentMonth,currentDay);
if(day==2)
cprintf("%d-%d-%d,Tuesday!",currentYear,currentMonth,currentDay);
if(day==3)
cprintf("%d-%d-%d,Wednesday!",currentYear,currentMonth,currentDay);
if(day==4)
cprintf("%d-%d-%d,Thursday!",currentYear,currentMonth,currentDay);
if(day==5)
cprintf("%d-%d-%d,Friday!",currentYear,currentMonth,currentDay);
if(day==6)
cprintf("%d-%d-%d,Saturday!",currentYear,currentMonth,currentDay);
textcolor(7);
}

/*输出指定星期函数*/
void printWeek2(int week)
{
if(week==0)
cprintf(",Sunday");
if(week==1)
cprintf(",Monday");
if(week==2)
cprintf(",Tuesday");
if(week==3)
cprintf(",Wendesday");
if(week==4)
cprintf(",Thursday");
if(week==5)
cprintf(",Friday");
if(week==6)
cprintf(",Staturday");
}

/*显示日历函数*/
void showCalendar(int year,int month,int day)
{
int i;
int j;
/*输出的日期*/
int outDay;
int leapFlag;
/*本月第一个星期中,在上月的天数*/
int dayLastMon;
int week;
/*该数组用于保存每个月的天数*/
int a[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
outDay=0;
dayLastMon=0;
week=0;

/*判断给定年份是否是闰年*/
leapFlag=isLeapyear(year);
/*如果是闰年则2月应该是29天*/
if(leapFlag==1)
{
a[2]++;
}

/*如果给定的日期中,天数大于该月的最大天数*/
if(day>a[month])
{
printf("The number of this month's day is %d at most !\n",a[month]);
printf("Press any key to continue......\n");
getchar();
getchar();
/*以当前系统时间重新赋值*/
year=sysTime.da_year;
month=sysTime.da_mon;
day=sysTime.da_day ;
currentYear=sysTime.da_year;
currentMonth=sysTime.da_mon;
currentDay=sysTime.da_day ;
}

/*当前月的天数*/
n_currentMon=a[month];
/*上一月的天数*/
n_lastMon=a[month-1];
/*根据给定日期,获取给定月份1号的星期*/
week=dayLastMon=getWeek(year,month,1);

/*清除文本模式窗口*/
clrscr();
printf("\nThe calendar of %d",year);
textcolor(10);

/*显示给定年份是否是闰年*/
if(leapFlag==1)
cprintf(" [leap year]",year);
if(leapFlag==0)
cprintf(" [not leap year]",year);
printf("\n");
textcolor(7);
printSeparator();
textcolor(YELLOW);

/*输出月份提示,1-12分别表示1月到12月*/
switch(month)
{
case 1 :
cprintf(" January 1 ");
break ;
case 2 :
cprintf(" February 2 ");
break ;
case 3 :
cprintf(" March 3 ");
break ;
case 4 :
cprintf(" April 4 ");
break ;
case 5 :
cprintf(" May 5 ");
break ;
case 6 :
cprintf(" June 6 ");
break ;
case 7 :
cprintf(" July 7 ");
break ;
case 8 :
cprintf(" August 8 ");
break ;
case 9 :
cprintf(" September 9 ");
break ;
case 10 :
cprintf(" October 10 ");
break ;
case 11 :
cprintf(" Nevember 11 ");
break ;
case 12 :
cprintf(" December 12");
break ;
}
textcolor(7);
printf("\n\n");
textcolor(13);
cprintf(" Sun Mon Tue Wed Thu Fri Sat");
textcolor(7);
printf("\n\n");

/*因为一个月中最多跨度6个星期,所以循环从0到5*/
for(i=0;i<6;i++)
{
/*如果是该月的第一个星期*/
if(i==0)
{
/*第一个星期中还要7-dayLastMon天本月,有dayLastMon天在上个月,
所以输出dayLastMon*4个空格符,每个日期在日历中占用4个空格*/
printSpace(dayLastMon*4);
/*剩余在本月的第一个星期中的天数为7-dayLastMon*/
for(j=0;j<7-dayLastMon;j++)
{
/*到达day的前一天时,输出++outDay*/
if(outDay==day-1)
{
/*用*字体突出显示*/
textcolor(YELLOW);
cprintf(" [%d]",++outDay);
textcolor(7);
}
/*到达day当天时,并且不是星期天*/
else if(outDay==day && week!=0)
{
printf("%3d",++outDay);
}
/*到达day当天时,并且是星期天*/
else
{
printf("%4d",++outDay);
}
/*计算当天的星期,如果前一天是星期六(6),则当天是星期天(0),
其他情况则直接星期加1*/
week=(week<6)?week+1:0;
}
printf("\n\n");
}

/*如果不是该月的第一个星期*/
else
{
/*则输出该星期中的7天*/
for(j=0;j<7;j++)
{
/*输出的天数小于该月的最大天数*/
if(outDay<a[month])
{
/*到达day的前一天时,输出++outDay*/
if(outDay==day-1)
{
/*输出一位数字*/
if(outDay<9)
{
textcolor(YELLOW);
cprintf(" [%d]",++outDay);
textcolor(7);
}
/*输出两位数字*/
else
{
textcolor(YELLOW);
cprintf(" [%2d]",++outDay);
textcolor(7);
}
}
/*到达day当天时,并且不是星期天*/
else if(outDay==day && week!=0)
{
printf("%3d",++outDay);
}
/*到达day当天时,并且是星期天*/
else
{
printf("%4d",++outDay);
}
}
/*计算当天星期*/
week=(week<6)?week+1:0;
}
printf("\n\n");
if(outDay==a[month])break ;
}
}
/*输出分隔线*/
printSeparator();

/*输出当前选择的日期和星期*/
printf("The day you choose is:\n\n");
printWeek();
gotoxy(1,22);
textcolor(10);
cprintf("--------------------\n");
textcolor(7);

/*输出系统日期和星期*/
printf("\nToday is: %d-%d-%d",sysTime.da_year,sysTime.da_mon,sysTime.da_day);
printWeek2(getWeek(sysTime.da_year,sysTime.da_mon,sysTime.da_day));
printf("\n\n");
/*显示按键操作*/
printUsage();
gotoxy(1,25);
}

/*通过键盘调整日期函数*/
void getKeyValue()
{
int key ;
char ch;
/*默认显示当前系统日期和星期*/
currentYear=sysTime.da_year;
currentMonth=sysTime.da_mon;
currentDay=sysTime.da_day ;
showCalendar(currentYear,currentMonth,currentDay);

while(1)
{
/*获取键值,根据键值调整日历输出*/
key=bioskey(0);
/*右移键,增加月份*/
if(key==RIGHT)
{
/*月份值在1-12之间,则直接加1*/
if(currentMonth<12 && currentMonth>=1)
{
currentMonth++;
}
/*如果月份为12,则加1后进位,即年份加1,月份变为1*/
else
{
currentYear++;
currentMonth=1 ;
}
}
/*左移键,减少月份*/
if(key==LEFT)
{
/*月份值在1-12之间,则直接减1*/
if(currentMonth<=12 && currentMonth>1)
{
currentMonth--;
}
/*如果月份为1,则减1后,到上一年,月份变为12*/
else
{
currentYear--;
currentMonth=12 ;
}
}
/*上移键,增加年份*/
if(key==UP)
{
currentYear++;
}
/*下移键,减少年份*/
if(key==DOWN)
{
currentYear--;
}
/*上移键,减少天数*/
if(key==PAGEUP)
{
/*当前日不是该月的第一天,则天数直接减1*/
if(currentDay!=1)
{
currentDay--;
}
/*当前日是该月的第一天,并且是该年的第一个月(即1月1日),
则天数减1后,变为上一年的最后一个月的最后一天(即12月31日)*/
else if(currentDay==1 && currentMonth==1)
{
currentYear--;
currentMonth=12 ;
currentDay=31 ;
}
/*当前日是该年中某一个月的最后一天,则天数减1后,
变为上个月的最后一天*/
else
{
currentMonth--;
currentDay=n_lastMon ;
}
}
/*下移键,增加天数*/
if(key==PAGEDOWN)
{
/*当前日不是该月的最后一天,则天数直接加1*/
if(n_currentMon!=currentDay)
{
currentDay++;
}
/*当前日是该年的最后一天(即12月31日),则天数加1后,
变为下一年的第一个月的第一天(即1月1日)*/
else if(n_currentMon==currentDay && currentMonth==12)
{
currentYear++;
currentMonth=1 ;
currentDay=1 ;
}
/*当前日是该年中某一个月的最后一天,则天数加1后,
变为下个月的第一天*/
else
{
currentMonth++;
currentDay=1 ;
}
}
/*Q或者q键,表示查询指定日期的星期*/
if(key==QLOWER||key==QUPPER)
{

{
printf("Input date(eg,%d-%d-%d):",sysTime.da_year,sysTime.da_mon,sysTime.da_day);
scanf("%d-%d-%d",¤tYear,¤tMonth,¤tDay);
checkDate();
}
}
/*空格键,重置到系统日期*/
if(key==SPACE)
{
currentYear=sysTime.da_year;
currentMonth=sysTime.da_mon;
currentDay=sysTime.da_day ;
}
/*Escpe键退出系统*/
if(key==ESC)
{
printf("Do you really want to quit?(Y/N)");
ch=getchar();
if(ch=='y'||ch=='Y')
break ;
}
showCalendar(currentYear,currentMonth,currentDay);
}
}

/*主函数*/
void main()
{
/*清除文本模式窗口*/
clrscr();
/*设置屏幕显示方式*/
_AL=03;
_AH=0;
geninterrupt(0x10);
getdate(&sysTime);
getKeyValue();
}

热心网友 时间:2023-11-02 08:18

#include<stdio.h>
//#include<windows.h>
int days[]={0,31,59,90,120,151,181,212,243,273,304,334,365};
int month[]={31,28,31,30,31,30,31,31,30,31,30,31};
char weekday[7][7]={"一","二","三","四","五","六","七"};
int week(int y,int m,int d)
{
int day=0;
day=days[m-1]+d-1;
return (y-1+(y-1)/4-(y-1)/100+(y-1)/400+day)%7;
}
void print()
{
puts("1.Week(查询某天是星期几)");
puts("2.Month(打印某月日历)");
puts("3.Calendar(打印某年日历)");
puts("4.Exit(退出)");
}
void printmonth(int y,int m)
{
int i,j,w;
w=(week(y,m,1)+1)%7;
puts(" SUN MON TUE WED THU FRI SAT");
for(i=1;i<=w;i++)
printf("%5c",' ');
for(j=i;j<i+month[m-1]+(m==2&&(y%4==0&&(y%100)||y%400==0));j++)
{
printf("%5d",j-i+1);
if(j%7==0)
puts("");
}
if((j-1)%7)
puts("");
}
int main()
{
int i,y,m,d,c;
char op[1];
print();
while(scanf("%d",&c)==1)
{
if(c==1)
{
do
{
puts("请输入年月日(XXXX,XX,XX)");
scanf("%d%d%d",&y,&m,&d);
printf("%4.4d年%2.2d月%2.2d日是星期%s,是否继续查询(Y/N)?\n",y,m,d,weekday[week(y,m,d)]);
scanf("%s",op);
}while(op[0]=='Y');
print();
}
if(c==2)
{
do
{
puts("请输入要打印的月份(XXXX)");
scanf("%d%d",&y,&m);
printf(" %4.4d年%2.2d月\n",y,m);
printmonth(y,m);
puts("是否继续打印(Y/N)?");
scanf("%s",op);
}while(op[0]=='Y');
print();
}
if(c==3)
{
do
{
puts("请输入要打印的年份(XXXX)");
scanf("%d",&y);
printf(" %4.4d\n",y);
for(i=1;i<=12;i++)
{
printf(" %2.2d月\n",i);
printmonth(y,i);
}
puts("是否继续打印(Y/N)?");
scanf("%s",op);
}while(op[0]=='Y');
print();
}
if(c==4)
{
puts("是否要真的退出(Y/N)?");
scanf("%s",op);
if(op[0]=='Y')
return 0;
else print();
}
}
}

热心网友 时间:2023-11-02 08:18

万年历
#include
"stdio.h"
/*
Required
for
MS-DOS
use
*/
#define
ENTER
0x1C0D
/*
Enter
key
*/
int
year,
month,
day;
static
char
*days[8]
=
{"
","Sunday
","Monday
","Tuesday
",
"Wednesday","Thursday
","Friday
","Saturday
"};
struct
TIMEDATE
{
int
year;
/*
year
1980..2099
*/
int
month;
/*
month
1=Jan
2=Feb,
etc.
*/
int
day;
/*
day
of
month
0..31
*/
int
hours;
/*
hour
0..23
*/
int
minutes;
/*
minute
0..59
*/
int
seconds;
/*
second
0..59
*/
int
hsecs;
/*
1/100ths
of
second
0..99
*/
char
dateline[47];
/*
date
&
time
together
*/
};
static
struct
TIMEDATE
today;
main()
{
char
cmonth[3];
char
cday[3];
char
cyear[5];
double
getdays();
double
daynumb,
numbnow;
int
weekday,
retcode,
dayer,
i;
dayer
=
datetime(&today);
clrscn();
for
(i=0;i<3;++i)cmonth[i]='\0';
for
(i=0;i<3;++i)cday[i]='\0';
for
(i=0;i<5;++i)cyear[i]='\0';
putstr(5,8,14,"Enter
date
in
MM
DD
YYYY
format:");
while
(retcode
!=
ENTER)
{
retcode
=
bufinp(5,41,13,2,cmonth);
if
(retcode
!=
ENTER)
retcode
=
bufinp(5,44,13,2,cday);
if
(retcode
!=
ENTER)
retcode
=
bufinp(5,47,13,4,cyear);
}
year
=
atoi(&cyear);
month
=
atoi(&cmonth);
day
=
atoi(&cday);
daynumb
=
getdays(year,
month,
day);
numbnow
=
getdays(today.year,
today.month,
today.day);
weekday
=
weekdays(daynumb);
if
(numbnow
-
daynumb
==
0)
printf("\n\n%02d-%02d-%d
is",month,
day,
year);
if
(numbnow
-
daynumb
>
0)
printf("\n\n%02d-%02d-%d
was",month,
day,
year);
if
(numbnow
-
daynumb
<
0)
printf("\n\n%02d-%02d-%d
will
be",month,
day,
year);
printf("
a
%s\n",days[weekday]);
}
/*
end
MAIN
*/
/************************************************************
*
GETDAYS
-
From
integer
values
of
year
(YYYY),
month
*
*
(MM)
and
day
(DD)
this
subroutine
returns
a
*
*
double
float
number
which
represents
the
*
*
number
of
days
since
Jan
1,
1980
(day
1).
*
*
This
routine
is
the
opposite
of
GETDATE.
*
************************************************************/
double
getdays(year,
month,
day)
int
year,
month,
day;
{
int
y,m;
double
a,b,d,
daynumb;
double
floor(),intg();
/**********************************
**
make
correction
for
no
year
0
**
**********************************/
if
(year
<
0)
y
=
year
+
1;
else
y
=
year;
/*********************************************************
**
Jan
and
Feb
are
months
13
and
14
in
this
calculation
**
*********************************************************/
m
=
month;
if
(month
<
3)
{
m
=
m
+
12;
y
=
y
-
1;
}
/**************************
**
calculate
Julian
days
**
**************************/
d
=
floor(365.25
*
y)
+
intg(30.6001
*
(m
+
1))
+
day
-
723244.0;
/**********************************************
**
use
Julian
calendar
if
before
Oct
5,
1582
**
**********************************************/
if
(d
<
-145068.0)
daynumb
=
d;
/*************************************
**
otherwise
use
Gregorian
calendar
**
*************************************/
else
{
a
=
floor(y
/
100.0);
b
=
2
-
a
+
floor(a
/
4.0);
daynumb
=
d
+
b;
}
return(daynumb);
}
/*
end
GETDAYS
*/
/********************************************************
*
GETDATE
-
This
routine
takes
a
double
float
number
*
*
representing
the
number
of
days
since
Jan
1,*
*
1980
(day
1)
and
returns
the
year
month
and
*
*
day
as
pointer
integers
*
*
This
routine
is
the
opposite
of
GETDAYS
*
********************************************************/
getdate(numb)
double
numb;
{
double
a,aa,b,c,d,e,z;
double
date;
date
=
numb;
z
=
intg(date
+
2444239.0);
if
(date
<
-145078.0)
a
=
z;
else
{
aa
=
floor((z
-
1867216.25)
/
36524.25);
a
=
z
+
1
+
aa
-
floor(aa/4.0);
}
b
=
a
+
1524.0;
c
=
intg((b
-
122.1)
/
365.25);
d
=
intg(365.25
*
c);
e
=
intg((b
-
d)
/
30.6001);
day
=
b
-
d
-
intg(30.6001
*
e);
if
(e
>
13.5)
month
=
e
-
13.0;
else
month
=
e
-
1.0;
if
(month
>
2)
year
=
c
-
4716.0;
else
year
=
c
-
4715.0;
if
(year
<
1)
--year;
return;
}
/*
end
GETDATE
*/
/********************************************************
*
WEEKDAYS
-
This
routine
takes
a
double
float
number
*
*
representing
the
number
of
days
since
Jan
1,*
*
1980
(day
1)
and
returns
the
day
of
the
week*
*
where
1
=
Sunday,
2
=
Tuesday,
etc.
*
********************************************************/
int
weekdays(numb)
double
numb;
{
double
dd;
int
day;
dd
=
numb;
while
(dd
>
28000.0)
dd
=
dd
-
28000.0;
while
(dd
<
0)
dd
=
dd
+
28000.0;
day
=
dd;
day
=
((day
+
1)
%
7)
+
1;
return(day);
}
/********************************************************
*
FRACT
-
This
routine
takes
a
double
float
number
*
*
and
returns
the
fractional
part
as
a
double
*
*
float
number
*
********************************************************/
double
fract(numb)
double
numb;
{
int
inumb;
double
fnumb;
while
(numb
<
-32767)
numb
+=
32767;
while
(numb
>
32767)
numb
-=
32767;
inumb
=
numb;
fnumb
=
inumb;
return(numb-fnumb);
}
/*
end
FRACT
*/
/********************************************************
*
FLOOR
-
This
routine
takes
a
double
float
number
*
*
and
returns
the
next
smallest
integer
*
********************************************************/
double
floor(numb)
double
numb;
{
double
fract(),
intg();
double
out;
out
=
intg(numb);
if
(numb
<
0
&&
fract(numb)
!=
0)
out
-=
1.0;
return(out);
}
/*
end
FLOOR
*/
/********************************************************
*
INTG
-
This
routine
takes
a
double
float
number
*
*
and
returns
the
integer
part
as
a
double
*
*
float
number
*
********************************************************/
double
intg(numb)
double
numb;
{
double
fract();
return(numb
-
fract(numb));
}
/*
end
INTG
*/
声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com
从第一海水浴场到中山路玉姐烧烤怎么走 爱普生针式打印机色带怎么换爱普生打印机出故障了怎么处理 EPSON爱普生打印机色带更换的详细图文教程 EPSON爱普生打印机怎么安装色带? 下泰山游三阳观是什么时候的诗 为何重游泰山三阳观,让我体会到了“一心开,万心明”? 烧水为什么要开着壶盖 水开如果滚多长时间为好 放下名利学会欣赏作文 梦见亲吻金色的人 用C语言编写万年历。 用c语言编写一个万年历程序 怎样用c语言编写一个能显示系统当前日期的万年历 用C语言实现万年历 使用C语言编写万年历 如何用C语言编写个万年历 五千年前,沧桑风雨,。。。整个歌词是?歌名是什么 美国五千年前是什么朝代? 五千年前的中国? 五千年前中国人见面怎么行礼? 中国五千年前是什么样的?外国呢? 五千年前是什么时代 五千年前 是什么时代 五千年前古中国的国力和古埃及比,哪个会更强一些? 上下五千年所说的五千年前是什么时候,到底有没有那么久远的历史呢? 五千年前祖先有哪些发明? 五千年前的历史有哪些? 中国四、五千年前是什么样的时代。 双飞燕无线鼠标没电了怎么办 无线鼠标没电怎么办? 用c语言编写万年历系统,编程求大神支招 C语言编万年历 在印度,三元人民币能到买什么服务? 卢布暴跌后,10卢布可以买什么 十元人民币在印度能买啥 10卢比在巴基斯坦可以买什么东西 现在卢布的价值是多少 就是一卢布或100卢布能买什么东西 500卢比在印度能买什么? 沙皇时代10卢布相当于现代多大的购买力 700卢布能买什么 在印度100印度卢比能买什么吃 银行小额贷款能贷多少钱 个人小额贷款最多能贷多少钱 工商银行小额贷款,小额是指多少到多少的范围?有急用,求各位帮忙解答解答… “款”(法律概念) 法律条文中只有一款可以不写款只写项? 这两款 哪一款好看? 推荐一款6.7百左右的手机, 高中化学选修3-1有机化学基础的有关整理? 这两款卫衣,哪种款式好看?