求C语言200行以上的程序2个

求C语言200行以上的程序2个,要求简单些,给女朋友要的,没时间帮她写... 求C语言200行以上的程序2个,要求简单些,给女朋友要的,没时间帮她写 展开
 我来答
梦想_不遥远
2009-07-07 · TA获得超过4690个赞
知道小有建树答主
回答量:349
采纳率:0%
帮助的人:0
展开全部
期末的作业吧?呵呵 给你两个:

一、题目:家庭财务管理小程序
2.程序源代码:

/*money management system*/
#include "stdio.h"
#include "dos.h"
main()
{
FILE *fp;
struct date d;
float sum,chm=0.0;
int len,i,j=0;
int c;
char ch[4]="",ch1[16]="",chtime[12]="",chshop[16],chmoney[8];
pp: clrscr();
sum=0.0;
gotoxy(1,1);printf("|----------------------------------------------------|");
gotoxy(1,2);printf("| money management system(C1.0) 2000.03 |");
gotoxy(1,3);printf("|----------------------------------------------------|");
gotoxy(1,4);printf("| -- money records -- | -- today cost list -- |");
gotoxy(1,5);printf("| ------------------------ |-----------------------------|");
gotoxy(1,6);printf("| date: -------------- | |");
gotoxy(1,7);printf("| | | | |");
gotoxy(1,8);printf("| -------------- | |");
gotoxy(1,9);printf("| thgs: ------------------ | |");
gotoxy(1,10);printf("| | | | |");
gotoxy(1,11);printf("| ------------------ | |");
gotoxy(1,12);printf("| cost: ---------- | |");
gotoxy(1,13);printf("| | | | |");
gotoxy(1,14);printf("| ---------- | |");
gotoxy(1,15);printf("| | |");
gotoxy(1,16);printf("| | |");
gotoxy(1,17);printf("| | |");
gotoxy(1,18);printf("| | |");
gotoxy(1,19);printf("| | |");
gotoxy(1,20);printf("| | |");
gotoxy(1,21);printf("| | |");
gotoxy(1,22);printf("| | |");
gotoxy(1,23);printf("|--------------------------------------------------|");
i=0;
getdate(&d);
sprintf(chtime,"%4d.%02d.%02d",d.da_year,d.da_mon,d.da_day);
for(;;)
{
gotoxy(3,24);printf(" Tab __browse cost list Esc __quit");
gotoxy(13,10);printf(" ");
gotoxy(13,13);printf(" ");
gotoxy(13,7);printf("%s",chtime);
j=18;
ch[0 ]=getch();
if(ch[0]==27)
break;
strcpy (chshop,"");
strcpy(chmoney,"");
if(ch[0]==9)
{
mm:i=0;
fp=fopen("home.dat","r+");
gotoxy(3,24);printf(" ");
gotoxy(6,4);printf(" list records ");
gotoxy(1,5);printf("|-------------------------------------|");
gotoxy(41,4);printf(" ");
gotoxy(41,5);printf(" |");
while(fscanf(fp,"%10s%14s%f\n",chtime,chshop,&chm)!=EOF)
{
if(i==36)
{
getch();
i=0;
}
if ((i%36)<17)
{
gotoxy(4,6+i);
printf(" ");
gotoxy(4,6+i);
}
else
if((i%36)>16)
{
gotoxy(41,4+i-17);
printf(" ");
gotoxy(42,4+i-17);
}
i++;
sum=sum+chm;
printf("%10s %-14s %6.1f\n",chtime,chshop,chm);}
gotoxy(1,23);printf("|----------------------------------------------|");
gotoxy(1,24);printf("| |");
gotoxy(1,25);printf("|----------------------------------------------|");
gotoxy(10,24);printf("total is %8.1f$",sum);
fclose(fp);
gotoxy(49,24);printf("press any key to.....");getch();goto pp;
}
else
{
while(ch[0]!='\r')
{
if(j<10)
{
strncat(chtime,ch,1);
j++;
}
if(ch[0]==8)
{
len=strlen(chtime)-1;
if(j>15)
{
len=len+1;
j=11;
}
strcpy(ch1,"");
j=j-2;
strncat(ch1,chtime,len);
strcpy(chtime,"");
strncat(chtime,ch1,len-1);
gotoxy(13,7);printf(" ");
}
gotoxy(13,7);printf("%s",chtime);ch[0]=getch();
if(ch[0]==9)
goto mm;
if(ch[0]==27)
exit(1);
}
gotoxy(3,24);printf(" ");
gotoxy(13,10);
j=0;
ch[0]=getch();
while(ch[0]!='\r')
{
if (j<14)
{
strncat(chshop,ch,1);
j++;
}
if(ch[0]==8)
{
len=strlen(chshop)-1;
strcpy(ch1,"");
j=j-2;
strncat(ch1,chshop,len);
strcpy(chshop,"");
strncat(chshop,ch1,len-1);
gotoxy(13,10);printf(" ");
}
gotoxy(13,10);printf("%s",chshop);ch[0]=getch();}
gotoxy(13,13);
j=0;
ch[0]=getch();
while(ch[0]!='\r')
{
if (j<6)
{
strncat(chmoney,ch,1);
j++;
}
if(ch[0]==8)
{
len=strlen(chmoney)-1;
strcpy(ch1,"");
j=j-2;
strncat(ch1,chmoney,len);
strcpy(chmoney,"");
strncat(chmoney,ch1,len-1);
gotoxy(13,13);printf(" ");
}
gotoxy(13,13);printf("%s",chmoney);ch[0]=getch();
}
if((strlen(chshop)==0)||(strlen(chmoney)==0))
continue;
if((fp=fopen("home.dat","a+"))!=NULL);
fprintf(fp,"%10s%14s%6s",chtime,chshop,chmoney);
fputc('\n',fp);
fclose(fp);
i++;
gotoxy(41,5+i);
printf("%10s %-14s %-6s",chtime,chshop,chmoney);
}
}
}

二、万年历

#include"iostream.h"
#include"iomanip.h"
#include"stdlib.h"
leapyear(int a)/*是否是闰年*/
{
if((a%4==0&&a%100!=0)||(a%100==0&&a%400==0))
return (1);
else return (0);
}
int aa[12]={31,28,31,30,31,30,31,31,30,31,30,31};
int cc[12]={31,29,31,30,31,30,31,31,30,31,30,31};
char bb[8][8]={"星期日","星期一","星期二","星期三","星期四","星期五","星期六"};
ww(int a,int b,int c)
{
int n=0,m=0,i,j,k=0;
for(i=1;i<c;i++)
{
if(leapyear(i)==1)
m=m+366;
else m=m+365;
}
for(j=1;j<b;j++)
{if(leapyear(c)==1) k=k+cc[j-1];
else k=k+aa[j-1];
}
n=(m+k+a)%7;
return n;
}
void yuefen(int m)
{
cout<<"最大天数是:";
if(m==2)
cout<<aa[m-1]+1;
else cout<<aa[m-1]<<endl;
}
void nianfen(int n)/*打印年份的日历*/
{
int i,j,k;
if(leapyear(n)==1)
{
for(j=1;j<=12;j++)
{
cout<<j;
cout<<"月份"<<endl;
cout<<" 日"<<" 一"<<" 二"<<" 三"<<" 四"<<" 五"<<" 六"<<endl;
for(i=0;i<ww(1,j,n);i++)
{
cout<<setw(4)<<"";
}
for(k=1;k<=cc[j-1];k++)
{
cout<<setw(4)<<k;
if((ww(1,j,n)+k)%7==0)
cout<<endl;
}
cout<<endl;
}
}
else
{
for(j=1;j<=12;j++)
{
cout<<j;
cout<<"月份"<<endl;
cout<<ww(1,j,n)<<endl;
cout<<endl<<" 日"<<" 一"<<" 二"<<" 三"<<" 四"<<" 五"<<" 六"<<endl;
for(i=0;i<ww(1,j,n);i++)
{
cout<<setw(4)<<"";
}
for(k=1;k<=aa[j-1];k++)
{
cout<<setw(4)<<k;
if((ww(1,j,n)+k)%7==0)
cout<<endl;
}
cout<<endl;
}
}
}
void nianyue(int n,int y)/*打印某年某月的月历*/
{
int i,k;
if(leapyear(n)==1)
{
cout<<" 日"<<" 一"<<" 二"<<" 三"<<" 四"<<" 五"<<" 六"<<endl;
for(i=0;i<ww(1,y,n);i++)
{
cout<<setw(4)<<"";
}
for(k=1;k<=cc[y-1];k++)
{
cout<<setw(4)<<k;
if((ww(1,y,n)+k)%7==0)
cout<<endl;
}
cout<<endl;
}
else
{ cout<<endl<<" 日"<<" 一"<<" 二"<<" 三"<<" 四"<<" 五"<<" 六"<<endl;
for(i=0;i<ww(1,y,n);i++)
{
cout<<setw(4)<<"";
}
for(k=1;k<=aa[y-1];k++)
{
cout<<setw(4)<<k;
if((ww(1,y,n)+k)%7==0)
cout<<endl;
}
cout<<endl;
}
}
void main()
{
int n,m;
int day,month ,year;
while(1)
{
cout<<"***********************************:"<<endl;
cout<<"1查询某年某月某日是星期几"<<endl
<<"2是否为闰年"<<endl
<<"3查询某月的最大天数"<<endl
<<"4打印某年的全年日历"<<endl
<<"5打印某年某月的月历"<<endl
<<"6exit"<<endl
<<"***********************************:"<<endl;
cout<<"请输入要操作的指令:"<<endl;
cin>>n;
switch(n)
{
case 1:cout<<"请输入要查询的日期:";
cout<<"year:";
cin>>year;
cout<<endl<<"month:";
cin>>month;
cout<<endl<<"day:";
cin>>day;
cout<<"星期是:";
cout<<bb[ww(day,month,year)]<<endl;break;
switch(ww(day,month,year))
{
case 1:cout<<"星期一";break;
case 2:cout<<"星期二";break;
case 3:cout<<"星期三";break;
case 4:cout<<"星期四";break;
case 5:cout<<"星期五";break;
case 6:cout<<"星期六";break;
case 7:cout<<"星期日";break;
}
cout<<endl;break;
case 2:cout<<"请输入要查询的年份:";
cin>>m;
if(leapyear(m)==1) cout<<"是闰年"<<endl;
else cout<<"不是闰年,请返回重新输入"<<endl;
break;
case 3:cout<<"请输入月份:";
cin>>m;
yuefen(m);break;
case 4:cout<<"请输入所要打印年份:";
cin>>m;
nianfen(m);break;
case 5:cout<<"请输入年份:";
cin>>n;
cout<<endl<<"请输入月份:";
cin>>m;
cout<<endl;
nianyue(n,m);break;
case 6:exit(0);
}
}
}
丽雅巧34
2009-07-07 · 超过26用户采纳过TA的回答
知道答主
回答量:103
采纳率:0%
帮助的人:62.4万
展开全部
哈哈哈 第一次听说以行数来写程序 呵呵呵
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
司徒剑仙
2009-07-07 · TA获得超过234个赞
知道小有建树答主
回答量:275
采纳率:0%
帮助的人:217万
展开全部
给个要求吧
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
百度网友87e0a9b
2009-07-07 · TA获得超过1323个赞
知道小有建树答主
回答量:630
采纳率:0%
帮助的人:562万
展开全部
要求呢?
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 更多回答(2)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式