找回密码
 注册
搜索
热搜: 回贴
  • 前程无忧官网首页 有什么好的平台可以
  • 最新的销售平台 互联网营销的平台有哪
  • 制作网页的基本流程 网页制作和网页设
  • 【帝国CMS】输出带序号的列表(数字排
  • 网站建设公司 三一,中联,极东泵车的
  • 织梦 建站 织梦网站模版后台怎么更改
  • 云服务官网 哪些网站有免费的简历模板
  • 如何建网站要什么条件 建网站要用什么
  • 吉林市移动公司电话 吉林省退休人员网
  • 设计类毕业论文 网站设计与实现毕业论
查看: 1705|回复: 0

各位大虾,帮帮忙呀,实在不知道怎么改了

[复制链接]
发表于 2009-11-3 03:30:53 | 显示全部楼层 |阅读模式 IP:江苏扬州
#include<iostream>
#include<fstream>
using namespace std;
#include<string>
class student
{
private:
     char num[10];
      char name[10];
      int grade;
      int clas;
      struct score1
      {float Chinese;
       float English;
       float Mathematics;
       float Physics;
       float Chemistry;
       float Biology;
      
            }S;
      struct score2
      {float Chineseps;
       float Englishps;
       float Mathematicsps;
       float Physicsps;
       float Chemistryps;
       float Biologyps;
      }PS;
      struct score3
      {float p2;
       float q3;
       float z3;
       float fd4;
       float fg5;
       float er6;
      }total;
     
public:
   
      char *getNumber();
      char *getName();
      int getgrade();
      int getclas();
      float getChinese();
      float getEnglish();
      float getMathematics();
      float getPhysics();
      float getChemistry();
      float getBiology();
      float getp2();
      float getq3();
      float getz3();
      float getfd4();
      float getfg5();
      float geter6();
      void Input();
      void Display();
};
char *student::getNumber()
{return num;
}
char *student::getName()
{return name;
}
int student::getclas()
{return clas;
}
int student::getgrade()
{return grade;
}
float student::getChinese()
{return S.Chinese;
}
float student::getMathematics()
{
       return S.Mathematics;
}

float student::getEnglish()
{

       return S.English;
}

float student::getPhysics()
{

       return S.Physics;
}

float student::getChemistry()
{

       return S.Chemistry;
}
float student::getBiology()
{

       return S.Biology;
}
float student::getp2()
{return S.Chinese*0.7+PS.Chineseps*0.3;
}
float student::getq3()
{return S.English*0.7+PS.Englishps*0.3;
}
float student::getz3()
{return S.Mathematics*0.7+PS.Mathematicsps*0.3;
}
float student::getfd4()
{return S.Physics*0.7+PS.Physicsps*0.3;
}
float student::getfg5()
{return S.Chemistry*0.7+PS.Chemistryps*0.3;
}
float student::geter6()
{return S.Biology*0.7+PS.Biologyps*0.3;
}

void student::Input()
{cout<<"请输入学生个人信息:"<<endl;
cout<<"学号:";cin>>num;
cout<<"姓名:";cin>>name;
cout<<"年级:";cin>>grade;
cout<<"班级:";cin>>clas;
cout<<"各科期末成绩:"<<endl;cout<<"语文"<<" ";cin>>S.Chinese;cout<<"英语"<<" ";cin>>S.English;
cout<<"数学"<<" ";cin>>S.Mathematics;cout<<"物理"<<" ";cin>>S.Physics;cout<<"化学"<<" ";
cin>>S.Chemistry;cout<<"生物"<<" ";cin>>S.Biology;cout<<endl;

cout<<"各科平时成绩:"<<endl;cout<<"语文"<<" ";cin>>PS.Chineseps;cout<<"英语"<<" ";cin>>PS.Englishps;
cout<<"数学"<<" ";cin>>PS.Mathematicsps;cout<<"物理"<<" ";cin>>PS.Physicsps;cout<<"化学"<<" ";
cin>>PS.Chemistryps;cout<<"生物"<<" ";cin>>PS.Biologyps;cout<<endl;
}
void student::Display()
{cout<<"输出学生个人信息:"<<endl;
cout<<"学号:"<<num<<" "<<"姓名:"<<name<<" "<<"年级:"<<grade<<" "<<"班级:"<<clas<<endl;
cout<<"各科期末成绩:"<<endl;
cout<<"语文"<<S.Chinese<<"英语"<<S.English<<"数学"<<S.Mathematics<<"物理"<<S.Physics
<<"化学"<<S.Chemistry<<"生物"<<S.Biology<<endl;
cout<<"各科总评成绩:"<<endl;
cout<<"语文"<<getp2()<<"英语"<<getq3()<<"数学"<<getz3()<<"物理"<<getfd4()
<<"化学"<<getfg5()<<"生物"<<geter6()<<endl;
}
class link_list
{private:
       struct linklist
       { student stu;
         struct linklist *next;
       }link;
public:
     void creat();
     void find(linklist *head);
};
void link_list::creat()
{ struct linklist *p,*q,*head;
   char z;
    head=new  linklist;
    head->next=0;
    q=head;
    p=new (struct linklist);
    p->stu.Input();
    p->stu.Display();
     head->next=p;
     q=p;
    cout<<"是否继续输入?(Y/N)";cin>>z;
    while(z=='Y')
     {p=new (struct linklist);
          p->stu.Input();
          p->stu.Display();
          q->next=p;
          q=p;         
    }      
   
        cout<<"录入完成!"<<endl;
   
  
}
void find(linklist *head)
{ linklist *p;
  p=head;
  char number[10];
  cout<<"请输入该学生的学号:";
  cin>>number;
  while(p->next->stu.getNumber()==number)
       p=p->next;
     if(p->next==NULL)
         cout<<"该学生信息不存在,请确认!"
         cout<<"该学生成绩为:"<<p->next->stu->number<<" "
         <<p->next->stu->getName()<<p->next->stu->getgrade()
         <<p->next->stu->getclas()<<p->next->stu->getp2()<<
         p->next->stu->getq3()<<p->next->stu->getz3()<<
         p->next->stu->getfd4()<<p->next->stu->getfg5<<
         p->next->stu->geter6()<<endl;

}

void main()
{link_list qs;
qs.creat();
qs.find(head);
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|小黑屋|最新主题|手机版|微赢网络技术论坛 ( 苏ICP备08020429号 )

GMT+8, 2024-9-30 13:23 , Processed in 0.213878 second(s), 12 queries , Gzip On, MemCache On.

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表