成都网站建设设计

将想法与焦点和您一起共享

c语言中的工资扣款函数 c语言工资发放问题

C语言的,帮我编一下.谢谢了

主要是1、2题哇???那我就开工了,直接输入的,没经过编译,自己查一下错。

专注于为中小企业提供成都网站制作、网站建设、外贸网站建设服务,电脑端+手机端+微信端的三站合一,更高效的管理,为中小企业阿尔山免费做网站提供优质的服务。我们立足成都,凝聚了一批互联网行业人才,有力地推动了成百上千家企业的稳健成长,帮助中小企业通过网站建设实现规模扩充和转变。

第一题:

#define MAX 0

#define MIN 1

float fun(float a[],float maxmin[])

{int i;

float average,s=0.;

maxmin[MAX]=maxmin[MIN]=a[0];

for(i=0;iN;i++)

{s+=a[i];

if(a[i]maxmin[MAX])maxmin[MAX]=a[i];

if(a[i]=maxmin[MIN])maxmin[MIN]=a[i];

}

average=s/N;

return average;

}//返回的是平均分,主函数定义一个数组maxmin[2]存放最高分和最低分

第二题:

e.....好像n久前做过一次,找找...

哈哈,拿分拿分!!

#includemath.h

#includestdio.h

float avxue(float (*p)[4],int n)

{int i;

float s=0,average;

for(i=0;i4;i++)

s+=*(*(p+n)+i);

average=s/4;

return(average);

}

float avke(float (*p)[4],int n)

{float s=0,average;

int i;

for(i=0;i4;i++)

s+=*(*(p+i)+n);

average=s/4;

return(average);

}

notpass(char *name[],float (*p)[4])

{int i,j,k,s,y=0;

float *q;

printf("\n\nThe one who did not pass twice :\n");

for(i=0;i4;i++)

{q=*(p+i);s=0;

for(j=0;j4;j++)

if(*(*(p+i)+j)60)s+=1;

if(s=2)

{y=1;

printf("%-8s ",name[i]);

for(k=0;k4;k++)

printf("%4.2f ",*(q+k));

printf("\n");

}

}

if(y==0)printf("none!!");

}

good(char *name[],float (*p)[4])

{int i,j,k,s,x,y=0;

float *q;

printf("\n\nThe one whose average 90 or whose all 85:\n");

for(i=0;i4;i++)

{q=*(p+i);s=0;x=0;

for(j=0;j4;j++)

{s+=*(*(p+i)+j);

if(*(*(p+i)+j)=85)x+=1; }

if((s=360)||(x==4))

{y=1;

printf("%-8s ",name[i]);

for(k=0;k4;k++)

printf("%4.2f ",*(q+k));

printf("\n");

}

}

if(y==0)printf("none!!");

}

main()

{float a[4][4]={{88,92,94,72},{99,89,88,100},{68,48,57,71},{86,87,88,97}};

float (*p)[4];

int i,j;

float average[4],average_k[4];

float s=0;

char *kecheng[]={"Math","Chinese","English","C++","average"};

char *name[]={"Smith","Billy","Bill","Tom"};

sqrt(0);

p=a;

for(i=0;i4;i++)

{average[i]=avxue(p,i);

average_k[i]=avke(p,i);

}

printf("\t");

for(i=0;i5;i++)

printf("%-8s",kecheng[i]);

printf("\n\n");

for(i=0;i4;i++)

{printf("%-8s",name[i]);

for(j=0;j4;j++)

printf("%-8.2f",*(*(p+i)+j));

printf("%-5.2f\n",average[i]);

printf("\n\n");

}

printf("average ");

for(i=0;i4;i++)

printf("%-8.2f",average_k[i]);

notpass(name,p);

good(name,p);

getch();

printf("\n\nplz change the parameters yourself!and site my answer be the best answer!thx!\npress any key to exit!");

}

求助C语言高手~!谢谢大家了!

#include iostream.h

#include string.h

#include fstream.h

struct student

{

char num[10];

char name[20];

int age;

int score;

struct student *next;

};

class grade

{

private :

struct student * head,* last;

public :

void init();

void insert();

int delete();

int select();

int modify();

int display();

int total();

void savefile();

void quit();

};

void grade::init()

{

printf("************************************主菜单************************************\n");

printf("\t1输入学生资料\t\t\t\t\t2删除学生资料\n");

printf("\t3查询学生资料\t\t\t\t\t4修改学生资料\n");

printf("\t5显示学生资料\t\t\t\t\t6统计学生成绩\n");

printf("\t7保存学生资料\t\t\t\t\t0退出系统\n");

printf("******************************************************************************\n");

head=last=NULL;

}

void grade::insert()

{

struct student * p;

p=(struct student *)malloc(sizeof(struct student));

cout"please insert num,name,age,score"endl;

cinp-nump-namep-agep-score;

if (head==NULL) {head=p;last=p;last-next=NULL;}

else

{

last-next=p;

last=p;

last-next=NULL;

}

}

int grade::delete()

{

char dnum;/* 要删除的学号*/

struct student * p,p1;

cout"请你输入要删除的学号:"endl;

cindnum;

if (head==NULL) {cout"no student can be found"endl;return 0;}

if (head-next=NULL strcpy(head-num,dnum)==0)/* 只有一个记录且是要删除的数据*/

{head=NULL;last=NULL;return 0;}

p=head;

while(p-next!=NULL)

{

p1=p-next;

if (strcpy(p-num,dnum)==0 p1-next==NULL )/* 数据在到数第二的位置*/

{p-next=last;cout"one student has been deleted"endl;return 0;}

else if (p1==NULL strcpy(p1-num,dnum)==0)/* 数据在到数第一的位置*/

{p-next=NULL;last=p;cout"one student has been deleted"endl;return 0;}

else if (strcpy(p-num,dnum)==0 p1-next!=NULL )

{p-next=p1-next;p=p1;/*p=p1;等一下次执行p=p-next;实际p已经指到p1-next了*/

cout"one student has been deleted"endl;return 0;}

p=p-next;

}

cout"no student can be found"endl;return 0;

}

int grade::select()

{

char snum;/* 要查询的学号*/

struct student * p;

cout"请你输入要查询的学号:"endl;

cinsnum;

p=head;

while(p!=NULL)

{

if (strcpy(p-num,snum)==0)

{

cout"num:"p-num"\nname"p-name"\nage"p-age"\nscore"p-scoreendl;

return 0;

}

p=p-next;

}

cout"no student can be found"endl;return 0;

}

int grade::modify()

{

char mnum;/* 要修改的学号*/

struct student *p;

cout"请你输入要修改的学号:"endl;

cinmnum;

p=head;

while(p!=NULL)

{

if (strcpy(p-num,mnum)==0)

{

cout"please insert the new name,age,score"endl;

cinp-namep-agep-score;

cout"one student has been modify"endl;

return 0;

}

p=p-next;

}

cout"no student can be found"endl;return 0;

}

int grade::display()

{

struct student *p;

p=head;

if (head==NULL) {cout"no student can be found"endl;return 0;}

while(p!=NULL)

{

cout"num:"p-num"\nname"p-name"\nage"p-age"\nscore"p-scoreendl;

p=p-next;

}

return 0;

}

int grade::total()

{

int max,jg_num=0;

struct student *p;

p=head;

if (head==NULL) {cout"no student can be found"endl;return 0;}

max=p-score;

while(p!=NULL)

{

if (p-scoremax) max=p-score;

if (p-score60) jg++;

p=p-next;

}

cout"the high score:"maxendl;

cout"不及格学生人数:"jgendl;

return 0;

}

void savefile()

{

struct student * p;

ifstream input;

input.open("student");

p=head;

while(p!=head)

{

inputp-nump-namep-agep-score;

p=p-next;

}

cout"the file save over"endl;

}

int main()

{

int choice;

grade Grage;

Grade.init();

while(1)

{

cinchoice;

switch(choice)

{

case 1:void Grade.insert(); break;

case 2:int Grade.delete(); break;

case 3:int Grade.select(); break;

case 4:int Grade.modify(); break;

case 5:int Grade.display();break;

case 6:int Grade.total(); break;

case 7:int Grade.savefile();break;

case 0: return 0;

}

}

return 0;

}

求大神用函数根据基本工资对应的扣款标准求扣款合计

D2用公式:

=C2*VLOOKUP(B2,IF({1,0},H$2:H$100,SUBSTITUTE(I$2:I$100,"元/班","")),2,)

数组公式,需要按CTRL+SHIFT+回车,完成公式。


网页标题:c语言中的工资扣款函数 c语言工资发放问题
链接URL:http://chengdu.cdxwcx.cn/article/dogeojs.html