2016校园招聘笔试编程题_1

#include "stdafx.h"  //#include <stdio.h>
#include <iostream>
#include <string.h>
using namespace std;

typedef struct StudentScore{
int iZZ;//政治成绩
int iEng;//英语成绩
int iMath;//数学成绩
int iMajor;//专业课成绩
}STU;

//单科成绩、总成绩检查
void Check(STU stuAry[],char * s[],int iLen)
{
int iSum = 0;
//int iLen = sizeof(stuAry)/sizeof(stuAry[0]);这里这样使用不对,sizeof(数组名)=sizeof(指针)=4
for (int i=0;i<3;i++)
{
iSum = stuAry[i].iZZ + stuAry[i].iEng + stuAry[i].iMath + stuAry[i].iMajor;//iEng + stu.iMajor + stu.iMath + stu.iZZ;
if(stuAry[i].iZZ<60 || stuAry[i].iEng < 60 || stuAry[i].iMajor <90 || stuAry[i].iMath<90 || iSum <310)//单科成绩英语、政治小于60;数学、专业课小于90;总分小于310时,不录取
{
s[i]="fail";
}
else if(iSum < 350)//当单科成绩满足要求,总分大于310而小于350时,自费录取
{
s[i]="zhifei";
}
else//当单科成绩满足,总分大于350时公费录取
{
s[i]="gongfei";
}
}  
}
//程序入口
int _tmain(int argc, _TCHAR* argv[])
{
int i=0;//计数
int n=0;//n 表示测试学生的个数


cout<<"Input the num of students : "<<endl;
cin >>n; 
STU Score[3];
for( ;i<n;i++)
{
cin>>Score[i].iZZ>>Score[i].iEng>>Score[i].iMath>>Score[i].iMajor;//stu.iMajor;
}
char *s[3]={0};
Check(Score,s,n+1);


//cout<<"*s="<<*s<<endl;
for( int i=0;i<3;i++)
{
cout<<(s[i])<<endl;
}
return 0;
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值