| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 662 人关注过本帖
标题:各位大虾,帮帮忙呀,实在不知道怎么改了
只看楼主 加入收藏
wds19840615
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2007-11-28
收藏
 问题点数:0 回复次数:6 
各位大虾,帮帮忙呀,实在不知道怎么改了
#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);
}
搜索更多相关主题的帖子: English private Chinese include 
2007-12-10 10:44
wds19840615
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2007-11-28
收藏
得分:0 
55
2007-12-10 10:47
sunkaidong
Rank: 4
来 自:南京师范大学
等 级:贵宾
威 望:12
帖 子:4496
专家分:141
注 册:2006-12-28
收藏
得分:0 
你的程序搞的我头都大啊,有没有大虾帮改改得.也给鹅看看啊
2007-12-10 21:05
圆圆的鸟蛋
Rank: 1
等 级:新手上路
帖 子:216
专家分:0
注 册:2007-4-22
收藏
得分:0 
具体有什么问题呀??
代码太长,你说一说问题在哪里,,也好改呀。。一行一行的逆向分析代码很费事的。。

鸟蛋开始孵化。。。我等待那一天Forever。。
2007-12-10 22:07
mfkpgfsbihc
Rank: 1
等 级:新手上路
帖 子:17
专家分:0
注 册:2007-11-25
收藏
得分:0 
using std namespace 放在<string>后面,要不然还得加一个using 语句
2007-12-10 22:18
wds19840615
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2007-11-28
收藏
得分:0 
xiexieha
谢谢大家哈,这个程序总是运行出现错误.我已经该过了,在定义第二个类时在私有成员变量里再加个
struct linklist *head其他再改几个小细节就可以了.
2007-12-11 10:16
wubin1988
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2007-4-26
收藏
得分:0 
天大的逻辑错误
天大的语法错误

重新想想
考虑清楚
2007-12-11 11:08
快速回复:各位大虾,帮帮忙呀,实在不知道怎么改了
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.058341 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved