求生活中的C语言实例(50--200行)

各位江湖救急啊!!!最好附上解析

第1个回答  2014-07-29
给你个小型工资管理系统吧 /*2、小型工资管理系统 编写一个小型工资管理系统。假设公司有四类人员: 总经理:固定月薪10000元; 销售经历:固定月薪5000元,另按其负责部门当月销售额的4%提成; 销售员:按其负责部门当月销售额的6%提成; 兼职技术员:每小时80元。*/ #include<iostream> using namespace std; float *process(float xse,float t) { float zjl=10000; float xsjl=5000; float xsy=0; float jzy=0; static float a[5]; xsjl=5000+0.04*xse; xsy=0.06*xse; jzy=80*t; a[0]=xsjl; a[1]=xsy; a[2]=jzy; return a; } void show(float a[]) { cout<<"总经理本月薪10000"<<endl; cout<<"——————————————————————"<<endl; cout<<"销售经理本月薪"<<a[0]<<endl; cout<<"——————————————————————"<<endl; cout<<"销售员本月薪"<<a[1]<<endl; cout<<"——————————————————————"<<endl; cout<<"兼职技术员本月薪"<<a[2]<<endl; cout<<"——————————————————————"<<endl; } float main() { float x,hour; float *p; char ch; do{cout<<"工资管理"<<endl; cout<<"——————————————————————"<<endl; cout<<"总经理固定月薪10000"<<endl; cout<<"——————————————————————"<<endl; cout<<"销售经理固定月薪5000元,另按其负责部门当月销售额的4%提成"<<endl; cout<<"——————————————————————"<<endl; cout<<"销售员:按其负责部门当月销售额的6%提成"<<endl; cout<<"——————————————————————"<<endl; cout<<"兼职技术员:每小时80元"<<endl; cout<<"——————————————————————"<<endl; cout<<"1、输入本月销售额和兼职员工作小时"<<endl; cout<<"2、退出"<<endl; cin>>ch; switch(ch){ case '1': cout<<"输入本月销售额和兼职员工作小时"<<endl; cin>>x>>hour; p=process(x,hour); show(p);break; case '2':exit(0);break; } }while(1); return 0; }
第2个回答  2014-07-30
数据结构中 链表的实现方法 几年前上学时候写的,从来没有优化过,质量不高,见谅…… #include "malloc.h" #include "stdlib.h" #include "stdio.h" #define Null 0 typedef struct Lnode { int data1; int data2; struct Lnode *next; } Lnode,*linklist; linklist Setuplinklist(int n) { int i; linklist p,head; head=(linklist)malloc(sizeof(Lnode)); head->next=Null; printf("Input the Number of linklist:"); for (i=n;i>0;i--) { p=(linklist)malloc(sizeof(Lnode)); scanf("%d %d",&p->data1,&p->data2); p->next=head->next; head->next=p; } p=head->next; while(p) { printf("(%d,%d)",p->data1,p->data2); p=p->next; } printf("\n"); p=head->next; return(p); } Insert(linklist head,int b,int c) { linklist m; m=(linklist)malloc(sizeof(Lnode)); m->data1=b; m->data2=c; m->next=head->next; head->next=m; return(1); } linklist Jia (linklist a,linklist b) { linklist m; m=a; while(a||b) { if(a->data1>b->data1) a=a->next; if(a->data1<b->data1) { Insert(m,b->data1,b->data2); b=b->next; } if(a->data1==b->data1) { if(a->data2+b->data2!=Null) { a->data2=a->data2+b->data2; a=a->next; b=b->next; } else { a->data2=0; a->data1=0; a=a->next; b=b->next; } } } return(m); } main() { linklist p1,p2,p3; int n1,n2; scanf("%d,%d",&n1,&n2); p1=Setuplinklist(n1); p2=Setuplinklist(n2); p3=Jia(p1,p2); while(p3) { printf("(%d %d)",p3->data1,p3->data2); p3=p3->next; } printf("\n"); }本回答被提问者采纳

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网