項目一学生成績統計

1243 ワード

/*  
*Copyright (c) 2013 ,           
*All rights reserved.  
*  :     
*    :2014 03 09 
*   :v1.0  
*    :              
*    :
*    :
*    :      ,        
*/  

#include <iostream>
using namespace std;
struct Student
{
    char num[13];//  
    char name[10];//  
    int cpp;//c++  
    int math;//    
    int english;//    
    int grade;//   
    double average;//    
};
const int N=5;
int main()
{

  int i,j,k;
  //       
  Student stu[N];
  cout<<"     ,  ,C++,  ,    "<<endl;
  for(i=0;i<3;i++)
   {
       cin>>stu[i].num>>stu[i].name>>stu[i].cpp>>stu[i].math>>stu[i].english;
       cout<<endl;
   }

   for(j=0;j<3;j++)
   {
    stu[j].grade=stu[j].cpp+stu[j].math+stu[j].english;
    stu[j].average=(stu[j].cpp+stu[j].math+stu[j].english)/3;
   }
   cout<<"  "<<"  "<<"  "<<"  "<<"  "<<" "<<"  "<<endl;

   for(k=0;k<3;k++)
   {
       cout<<stu[k].num<<" "<<stu[k].name<<" "<<stu[k].grade<<" " <<stu[k].average<<endl;
   }


    return 0;
}