rqnoj吧 关注:56贴子:180
  • 2回复贴,共1

谁拿了最多的奖学金求助。。。。。。。。只对了4个

只看楼主收藏回复

#include "iostream"
using namespace std;
int g_money;
void money(int b,int c,char d,char e,int f)
{
g_money=0;
if(b>80 && f>=1)
g_money=8000;
if(b>85 && c>80)
g_money=g_money+4000;
if(b>90)
g_money=g_money+2000;
if(b>85 && e=='Y')
g_money=g_money+1000;
if(b>80 && d=='Y')
g_money=g_money+850;
}
int main()
{
int t_money,f_money,z_money,N;
char s_name[200];
char sname[200];
int grade_1,grade_2,essay;
char i_ment,i_pool;
cin>>N;
f_money=0;
z_money=0;
while(N>0)
{
cin>>s_name>>grade_1>>grade_2>>i_ment>>i_pool>>essay;
money(grade_1,grade_2,i_ment,i_pool,essay);
f_money=f_money+g_money;
if(z_money<g_money)
{
strcpy(sname,s_name);
z_money=g_money;
}
N--;
}
cout<<sname<<endl;
cout<<z_money<<endl;
cout<<f_money<<endl;
return 0;
}


IP属地:江西1楼2012-12-03 14:14回复
    #include "iostream"
    using namespace std;
    int g_money; void money(int b,int c,char d,char e,int f)//计算每个学生得的奖学金
    {
    g_money=0;
    if(b>80 && f>=1)
    g_money=8000;
    if(b>85 && c>80)
    g_money=g_money+4000;
    if(b>90)
    g_money=g_money+2000;
    if(b>85 && e=='Y')
    g_money=g_money+1000;
    if(b>80 && d=='Y')
    g_money=g_money+850;
    }
    int main()
    {
    int f_money,z_money,N;//总金额、个人最大所得金额、学生数目
    char s_name[200];
    char sname[200] ;
    int grade_1,grade_2,essay;//期末成绩、班级成绩、论文数
    char i_ment,i_pool;//是否班干、是否西部学生
    cin>>N;
    f_money=0;
    z_money=0;
    while(N>0)
    {
    cin>>s_name>>grade_1>>grade_2>>i_ment>>i_pool>>essay;
    money(grade_1,grade_2,i_ment,i_pool,essay);
    f_money=f_money+g_money;//可能就是这个地方不对、但不知道哪里不对??
    if(z_money<g_money)
    {
    strcpy(sname,s_name);
    z_money=g_money;
    }
    N--;
    }
    cout<<sname<<endl;
    cout<<z_money<<endl;
    cout<<f_money<<endl;//前面两个都对、就是总金额错了
    return 0;
    }


    IP属地:江西2楼2012-12-03 14:20
    回复
      求助


      IP属地:江西3楼2012-12-03 14:20
      回复