C++课程设计题 “公司员工考勤管理系统设计” 吧表达式 a=3*5,a=b=3*2 的值用C++编程语言怎...

作者&投稿:岳海 (若有异议请与网页底部的电邮联系)
C++课程设计题 “公司员工考勤管理系统设计” 这有何难?手到擒来!!

可以给你定做一份

学生考勤系统设计c++程序(急求大神)~

我曾用c++做过学生成绩系统,你可以把成绩改成考勤。希望我的回答对你能够有所帮助!
#include
#include
#include
#include
#include
/*------------------------------------定义类部分------------------------------------------------*/
class Node
{
char name[10];
int score;
class Node *next;
public:
Node* CreateNode(int n);
void PrinfListNode(Node *h);
void InsertList(Node *h,int i,char name[],int e,int *n);
void DeleteList(Node *h,int i,int *n);
Node* operator +=(Node *p);
Node *Unique(Node *p,int *n);
};
void DisplayNote(void);

/*--------------------建立单链表的成员函数,单链表节点的个数不确定--------------------------------*/
Node *Node::CreateNode(int n)
{
Node *head;
Node *pre,*p;
int i;
head=(Node*)malloc(sizeof(Node)); //用malloc动态申请内存,个数作为函数的输入参数
head->next=NULL;
pre=head;
for (i=1;i<=n;i++)
{
printf("请输入学生姓名:",i);
p=(Node*)malloc(sizeof(Node));
scanf("%s",p->name);
printf("请输入此学生的分数:",i);
scanf("%d",&p->score);
pre->next=p;
pre=p;
}
p->next=NULL;
return head;
}
/*---------------------------------输出链表函数实现部分------------------------------------------*/
void Node::PrinfListNode(Node *h)
{
Node *p;
p=h->next;
while(p)
{
printf("name:%sscore:%d",p->name,p->score);
p=p->next;
printf("
");
}
}
/*----------------------------实现单链表的插入操作的成员函数--------------------------------------*/
void Node::InsertList(Node *h,int i,char name[],int e,int *n)
{
Node *p,*q;
int j;
if (i(*n)+1)
{
printf("出错啦!请重试!.
");
}
else
{
j=0;p=h;
while(j<i-1)
{
p=p->next;
j++;
}
q=(Node *)malloc(sizeof(Node));
strcpy(q->name,name);
q->score=e;
q->next=p->next;
p->next=q;
(*n)++;
}
}
/*-----------------------------实现单链表的删除操作的成员函数-------------------------------------*/
void Node::DeleteList(Node *h,int i,int *n)
{
Node *p,*q;
int j;
char name[10];
int score;
if (i(*n))
{
printf("出错啦!请重试!.
");
}
else
{
j=0;p=h;
while(j<i-1)
{
p=p->next;
j++;
}
q=p->next;
p->next=q->next;
strcpy(name,q->name);
score=q->score;
free(q);
(*n)--;
}
}
/*--------------------------重载运算符“+=”实现两个链表对象合并功能------------------------------*/
Node *Node::operator +=(Node *p)
{
Node *q=this;
while(q->next!=NULL) //把第一个链表最后的next指向第二个的头
{
q=q->next;
}
q->next=p->next;
return this;
}
/*----------------编写Unique()成员函数,实现剔除链表中重复元素,使所有节点值唯-----------------*/
Node *Node::Unique(Node *p,int *n)
{ Node *q=this,*k,*m;
int i;
if((*n)<=1) //用循环,拿一个和每一个去比较,一样的删除使用已经写好的删除函数
cout<<"ERROR!"<<endl;
else
{
for(i=1;inext)
{
k=q;
p=q->next;
while(p!=NULL)
{
if(strcmp(q->name,p->name)==0)
{
m=p;
p=p->next;
k->next=m->next;
free(m);
(*n)--;
}
else{
k=p;
p=p->next;
}

}
}
}
return this;
}
/*--------------------------------编写主函数测试上述功能---------------------------------------*/
int main()
{
Node *h,*k;
int i=1,n,score;
char name[10];
int *m=0;
while(i)
{
DisplayNote();
scanf("%d",&i);
switch(i)
{
case 1:
printf("请输入表中成员的个数:
");
scanf("%d",&n);
h=h->CreateNode(n);
printf("表中成员为:
");
h->PrinfListNode(h);
break;
case 2:
printf("请写出成员的位置:");
scanf("%d",&i);
printf("请输入学生姓名:");
scanf("%s",&name);
printf("请输入学生分数:");
scanf("%d",&score);
h->InsertList(h,i,name,score,&n);
printf("表中成员为:
");
h->PrinfListNode(h);
break;
case 3:
printf("请写出成员的位置:");
scanf("%d",&i);
h->DeleteList(h,i,&n);
cout<<"表中成员为:
";
h->PrinfListNode(h);
break;
case 4:
printf("表中成员为:
");
h->PrinfListNode(h);
break;
case 5:
printf("请输入另一个表中成员的个数:
");
scanf("%d",&n);
k=k->CreateNode(n);
h=h->operator +=(k);
printf("两个链表相加之后的链表是:
");
h->PrinfListNode(h);
break;
case 6:
h=h->Unique(h,&n);
printf("剔除重复元素后的新链表是:
");
h->PrinfListNode(h);
break;
case 0:
return 0;
break;
default:
printf("出错啦!请重试!");
}
}
return 0;
}
void DisplayNote(void)
{
printf("1--建立新的链表
");
printf("2--添加元素
");
printf("3--删除元素
");
printf("4--输出当前链表中的内容
");
printf("5--两个链表对象合并
");
printf("6--剔除链表中重复元素
");
printf("0--退出
");
}

//请自行运行一遍结果
#include

int main()
{
printf("鉴于你的问题有矛盾关系,修改如下:
");
printf("#include
");
printf("int a,b,c;
");
printf("a=3×5
");
printf("c=b=3×2
");
int a,b,c;
a=3*5;
c=b=3*2;
printf("a=%d b=%d c=%d
",a,b,c);
}