找回密码
 注册
搜索
热搜: 回贴
  • 前程无忧官网首页 有什么好的平台可以
  • 最新的销售平台 互联网营销的平台有哪
  • 制作网页的基本流程 网页制作和网页设
  • 【帝国CMS】输出带序号的列表(数字排
  • 网站建设公司 三一,中联,极东泵车的
  • 织梦 建站 织梦网站模版后台怎么更改
  • 云服务官网 哪些网站有免费的简历模板
  • 如何建网站要什么条件 建网站要用什么
  • 吉林市移动公司电话 吉林省退休人员网
  • 设计类毕业论文 网站设计与实现毕业论
查看: 812|回复: 9

[求助]一个C++程序来看看

[复制链接]
发表于 2009-11-4 01:39:53 | 显示全部楼层 |阅读模式 IP:江苏扬州
#include<iostream>
#include<iomanip>
#include<string>
#include<fstream>
#define N 10
using namespace std;
class MonthPunchIn //月出勤情况文件
{
public:
int num,thlate,thabsent,thask;//学号,迟到次数,请假天数,旷课天数
string name; //姓名


};
class punchIn:public MonthPunchIn//以时间计算迟到的次数
{
public:
int hour,minute,second,ask;
void late()
{
if(hour>8)
{
for(int i=0;i<6;i++)
if(minute>10*i&&minute<(10*i+10))
thlate+=(i+1);
}
}
int judgelate()//计算迟到数
{
int judge=0;
if(hour>8) judge++;
return judge;
}
int latetime()
{
int sum;
sum=hour*10000+minute*100+second;
return sum;
}
void absent(int s[N])//计算请假数,缺席数
{
ask=0;
for(int i=0;i<N;i++)
if(num==s[i]) ask++;
if(hour=='\0')
{
thabsent++;
if(ask)
{
thabsent--;
thask++;
}
}
}
};
void fun::list1()
{ cout<<setw(3)<<num<<" 到课时间"<<hour<<"时"<<minute<<"分"<<second<<"秒 迟到"<<monthlate<<"次 请假"<<monthask<<"天 旷课"<<thabsent<<"天";
cout<<endl;
}
void fun::list2()
{
cout<<setw(3)<<num<<" "<<name;
cout<<endl;
}
void fun::list3()
{
if(thask>5)
cout<<setw(3)<<num<<" "<<name<<" "<<birth<<" 请假"<<monthask<<"天";
cout<<endl;
}
void fun::list4()
{
if(thabsent!=0)
cout<<setw(3)<<num<<" "<<name<<" "<<birth<<" 迟到"<<thlate<<"天 请假"<<thask<<"天 旷课"<<thabsent<<"天";
cout<<endl;
}
void fun::list5()
{
cout<<setw(3)<<num<<" "<<name<<endl;
}
void main()
{
fun per[11];
per[1].thlate=2;//列举学生的基本信息
per[1].thabsent=3;
per[1].thask=4;
per[1].hour=8;
per[1].minute=10;
per[1].second=05;
per[1].num=1;
per[1].name="jiangwen";


per[2].monthlate=5;
per[2].monthabsent=4;
per[2].monthask=3;
per[2].hour=8;
per[2].minute=40;
per[2].second=10;
per[2].num=2;
per[2].name="huangwei";

per[3].monthlate=4;
per[3].monthabsent=1;
per[3].monthask=0;
per[3].hour=8;
per[3].minute=30;
per[3].second=30;
per[3].num=3;
per[3].name="jiayin";

per[4].thlate=3;
per[4].thabsent=1;
per[4].thask=1;
per[4].hour=8;
per[4].minute=20;
per[4].second=10;
per[4].num=4;
per[4].name="zhangzao";

per[5].thlate=2;
per[5].thabsent=0;
per[5].thask=0;
per[5].hour=8;
per[5].minute=20;
per[5].second=0;
per[5].num=5;
per[5].name="miaojinhua";

per[6].thlate=1;
per[6].thabsent=1;
per[6].thask=2;
per[6].hour=7;
per[6].minute=20;
per[6].second=0;
per[6].num=6;
per[6].name="haoxiuqing";

per[7].thlate=5;
per[7].thabsent=4;
per[7].thask=8;
per[7].hour=8;
per[7].minute=40;
per[7].second=30;
per[7].num=7;
per[7].name="baineng";
per[8].thlate=2;
per[8].thabsent=3;
per[8].thask=2;
per[8].hour=8;
per[8].minute=20;
per[8].second=0;
per[8].num=8;
per[8].name="liumin";
per[9].thlate=2;
per[9].thabsent=1;
per[9].thask=1;
per[9].hour=8;
per[9].minute=20;
per[9].second=0;
per[9].num=9;
per[9].name="guojin";

per[10].thlate=2;
per[10].thabsent=2;
per[10].thask=3;
per[10].hour=8;
per[10].minute=20;
per[10].second=0;
per[10].num=10;
per[10].name="wutianzhen";

int i,j,p;
int c0,c1,c2,c3;
int year,month,s[N];

cout<<"************************"<<endl;
cout<<"*****出勤卡数据管理*****"<<endl;
cout<<"************************"<<endl;
ff: cout<<"输入今年的年份:"<<endl;
cin>>year;
if(year>2006){cout<<"error!重新输入!"<<endl;goto ff;}
ss: cout<<"输入这个月的月份:"<<endl;
cin>>month;
if(month<1||month>12){cout<<"error!重新输入!"<<endl;goto ss;}

for(i=1;i<=N;i++)
{
per[i].late();
per[i].absent(s);
per[i].count(year,month);
}

k0:
cout<<"**********************************************************************"<<endl;
cout<<"选择需要使用的功能:"<<endl;
cout<<"1 查询"<<endl;
cout<<"2 统计"<<endl;
cout<<"3 排序"<<endl;
cin>>c0;
if(c0==1)
{
k1:
cout<<"**********************************************************************"<<endl;
cout<<"查询:"<<endl;
cout<<"1 按学生学号查询当日到课时间,当月出勤情况:"<<endl;
cout<<"2 列出所有全勤学生的清单:"<<endl;
cout<<"3 列出请假天数超过五天的学生情况:"<<endl;
cout<<"4 列出有旷课行为的全体学生的情况:"<<endl;
cout<<"输入需要查询的项目:"<<endl;
cin>>c1;

if(c1==1)
{
int n;
cout<<"输入需要查询的学生学号:"<<endl;
cin>>n;

for(int i=1;i<=N;i++)
{
if(per[i].num==n) per[i].list1();
}
}

if(c1==2)
{
int allfull=0;
for(i=1;i<=N;i++)
{
if(per[i].allpresent())
{
per[i].list2();
allfull++;
}
}

if(allfull==0)
{
cout<<"当月没有全勤学生!"<<endl;
}
}

if(c1==3)

{
for(i=1;i<=N;i++)
per[i].list3();
}

if(c1==4)
{
for(i=1;i<=N;i++)
per[i].list4();
}


char con1;
cout<<"继续查询按y 返回主菜单按n 按其他任意键+Enter退出:";
cin>>con1;
if(con1=='y') goto k1;
else if (con1=='n')goto k0;

}

if(c0==2)
{
k2:
cout<<"**********************************************************************"<<endl;
cout<<"统计:"<<endl;
cout<<"1 计算当前学生总数"<<endl;
cout<<"2 计算当月全勤学生总数及占全体学生的百分比"<<endl;
cout<<"3 计算当日迟到时间"<<endl;
cout<<"4 计算当月请假天数"<<endl;
cout<<"5 计算当月迟到次数"<<endl;
cout<<"6 计算当月旷课的最大天数"<<endl;
cout<<"7 计算当日迟到的学生总数及占学生总数的百分比"<<endl;
cout<<"输入需要统计的项目:"<<endl;
cin>>c2;
if(c2==1)
{
cout<<"当前学生总数:"<<N<<endl;
}

if(c2==2)
{
int n=0;
for(int i=1;i<=N;i++)
if(per[i].allpresent()) n++;
cout<<"当月全勤学生总数:"<<n<<endl;
cout<<"当月全勤学生占全体学生的百分比:"<<float(n)/N*100<<"%"<<endl;
}

if(c2==3)
{
int daylate;
daylate=per[1].latetime-80000;
for(i=1;i<=N;i++)
{
if(daylate<(per[i].latetime-80000))
daylate=per[i].latetime-80000;
}
cout<<"当日迟到时间:"<<daylate/100<<"分"<<daylate-100*(daylate/100)<<"秒"<<endl;
}
if(c2==4)
{
long ask;
ask=per[1].thask;
for(i=1;i<=N;i++)
{
if(ask<per[i].thask)
sk=per[i].thask;
}
cout<<"当月请假天数:"<<ask<<endl;
}
if(c2==5)
{
long late;
late=per[1].thlate;
for(i=1;i<=N;i++)
{
if(late<per[i].thlate)
late=per[i].thlate;
}
cout<<"当月迟到次数:"<<late<<endl;
}

if(c2==6)
{
long absent;
absent=per[1].thabsent;
for(i=1;i<=N;i++)
{
if(absent<per[i].thabsent)
absent=per[i].thabsent;
}
cout<<"当月旷课天数:"<<absent<<endl;
}
if(c2==7)
{
int latesum=0;
for(i=1;i<=N;i++)
{
if(per[i].latetime>80000)
latesum++;

}
cout<<"当日迟到学生总数:"<<latesum<<endl;
cout<<"当日迟到学生总数占学生总数百分比:"<<float(latesum)/N*100<<"%"<<endl;
}
char con2;
cout<<"继续统计按y 返回主菜单按n 按其他任意键+Enter退出:";
要求做的:

出勤管理系统
学生学号
学生姓名
课程名称
上课时间
到课时间
出勤状态 [旷课/病假/事假/迟到/早退]
能够对数据进行增、删、改、查操作。
能够按学号顺序列出某一课程的出勤状况。
。。。
具体的问题和改动请帮帮忙
发表于 2009-11-4 01:39:55 | 显示全部楼层 IP:江苏扬州
没人来 偶自己顶下
回复

使用道具 举报

发表于 2009-11-4 01:39:56 | 显示全部楼层 IP:江苏扬州
帮帮偶改改   偶先谢谢了
回复

使用道具 举报

发表于 2009-11-4 01:39:58 | 显示全部楼层 IP:江苏扬州
虽然帮不上忙, 还是得顶下先
回复

使用道具 举报

发表于 2009-11-4 01:39:59 | 显示全部楼层 IP:江苏扬州
N久没有发言了,顶一下就是了!
回复

使用道具 举报

发表于 2009-11-4 01:40:00 | 显示全部楼层 IP:江苏扬州
你哪里错了
回复

使用道具 举报

发表于 2009-11-4 01:40:01 | 显示全部楼层 IP:江苏扬州
不是写得挺好的吗
回复

使用道具 举报

发表于 2009-11-4 01:40:02 | 显示全部楼层 IP:江苏扬州
不会吧?运行有102个错误啊
回复

使用道具 举报

发表于 2009-11-4 01:40:04 | 显示全部楼层 IP:江苏扬州
...............102个。。。。。。。。。。。。。。
编译器有问题吧。。。。。。。。。。。。。。
回复

使用道具 举报

发表于 2009-11-4 01:40:05 | 显示全部楼层 IP:江苏扬州
看得我头都晕了,程序里void fun::list1() fun是类吧?程序里没有定义啊,程序是不是你写的啊,那么乱
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|小黑屋|最新主题|手机版|微赢网络技术论坛 ( 苏ICP备08020429号 )

GMT+8, 2024-10-1 03:31 , Processed in 0.196685 second(s), 12 queries , Gzip On, MemCache On.

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表