标题:【求助】十万火急!!!!!!!!!(望有能者能予以解决)
取消只看楼主
lovely123
Rank: 1
等 级:新手上路
帖 子:19
专家分:0
注 册:2007-11-29
 问题点数:0 回复次数:4 
【求助】十万火急!!!!!!!!!(望有能者能予以解决)
用类实现把八个同学的名字,学号,性别及五门课的成绩存入档案,当输入一个合法的学号时,即能查询出该同学的情况.
要求:1.查询的结果姓名,性别及五门课的成绩
        2.名字,学号,性别及五门课的成绩定义为学生类的私有成员.
(学号,学生名字,性别,课程名及成绩可以随便取.)
搜索更多相关主题的帖子: 能者 
2007-11-29 15:25
lovely123
Rank: 1
等 级:新手上路
帖 子:19
专家分:0
注 册:2007-11-29
得分:0 
定义到是知道的,编了50多行就有40多个错误,很是郁闷
2007-11-30 10:08
lovely123
Rank: 1
等 级:新手上路
帖 子:19
专家分:0
注 册:2007-11-29
得分:0 
还有一个错误,帮忙改下
#include<iostream>
#include <string>
using namespace std;
class Student
{
private:
    int num1,num2,num3,mun4,num5,num6,num7,num8;
    string name1,name2,name3,name4,name5,name6,name7,mane8;
    int age1,ahe2,age3,age4,age5,age6,age7,age8;
    char sex1,sex2,sex3,sex4,sex5,sex6,sex7,sex8;
    int a1,a2,a3,a4,a5,a6,a7,a8;
    int b1,b2,b3,b4,b5,b6,b7,b8;
    int c1,c2,c3,c4,c5,c6,c7,c8;
    int d1,d2,d3,d4,d5,d6,d7,d8;
    int e1,e2,e3,e4,e5,e6,e7,e8;
    void num()
    {cin>>"num1:">>"06300685">>endl;
    cin>>"num2:">>"06300686">>endl;
    cin>>"num3:">>"06300687">>endl;
    cin>>"num4:">>"06300688">>endl;
    cin>>"num5:">>"06300689">>endl;
    cin>>"num6:">>"06300690">>endl;
    cin>>"num7:">>"06300691">>endl;
    cin>>"num8:">>"06300692">>endl;
    };
    void name()
    {cin>>"name1:">>"譁鄵">>endl;
    cin>>"name2:">>"詉庅枏">>endl;
    cin>>"name3:">>"脦塍蓲">>endl;
    cin>>"name4:">>"虠轑鲻">>endl;
    cin>>"name5:">>"醟朙籩">>endl;
    cin>>"name6:">>"臡鼐孻">>endl;
    cin>>"name7:">>"恴赨">>endl;
    cin>>"name8:">>"絼躢閁鍀">>endl;
    };
    void age()
    {cin>>"age1:">>20>>endl;
    cin>>"age2:">>21>>endl;
    cin>>"age3:">>19>>endl;
    cin>>"age4:">>20>>endl;
    cin>>"age5:">>22>>endl;
    cin>>"age6:">>19>>endl;
    cin>>"age7:">>19>>endl;
    cin>>"age8:">>21>>endl;
    };
    void sex()
    {cin>>"sex1:">>"男">>endl;
    cin>>"sex2:">>"女">>endl;
    cin>>"sex3:">>"男">>endl;
    cin>>"sex4:">>"男">>endl;
    cin>>"sex5:">>"女">>endl;
    cin>>"sex6:">>"男">>endl;
    cin>>"sex7:">>"男">>endl;
    cin>>"sex8:">>"男">>endl;
    };
    void a()
    {cin>>"a1">>75>>endl;
    cin>>"a2">>100>>endl;
    cin>>"a3">>66>>endl;
    cin>>"a4">>84>>endl;
    cin>>"a5">>60>>endl;
    cin>>"a6">>86>>endl;
    cin>>"a7">>97>>endl;
    cin>>"a8">>58>>endl;
    };

    void b()
    {cin>>"b1"=93>>endl;
    cin>>"b2"=65>>endl;
    cin>>"b3"=69>>endl;
    cin>>"b4"=89>>endl;
    cin>>"b5"=88>>endl;
    cin>>"b6"=90>>endl;
    cin>>"b7"=94>>endl;
    cin>>"b8"=68>>endl;
    };

    void c()
    {cin>>"c1"=79>>endl;
    cin>>"c2"=68>>endl;
    cin>>"c3"=95>>endl;
    cin>>"c4"=56>>endl;
    cin>>"c5"=40>>endl;
    cin>>"c6"=76>>endl;
    cin>>"c7"=65>>endl;
    cin>>"c8"=60>>endl;
    };

    void d()
    {cin>>"d1"=87>>endl;
    cin>>"d2"=100>>endl;
    cin>>"d3"=75>>endl;
    cin>>"d4"=35>>endl;
    cin>>"d5"=55>>endl;
    cin>>"d6"=80>>endl;
    cin>>"d7"=87>>endl;
    cin>>"d8"=61>>endl;
    };

    void e()
    {cin>>"e1"=30>>endl;
    cin>>"e2"=72>>endl;
    cin>>"e3"=69>>endl;
    cin>>"e4"=88>>endl;
    cin>>"e5"=73>>endl;
    cin>>"e61"=99>>endl;
    cin>>"e7"=100>>endl;
    cin>>"e8"=57>>endl;
    };

  int main()

 {cout<<"请输入学号:"<<endl;
int s;
cin>>s;
if(s=num1)
{cout<<num1<<" "<<name1<<" "<<sex1<<" "<<a1+b1+c1+d1+e1<<endl;}
if(s=num2)
{cout<<num2<<" "<<name2<<" "<<sex2<<" "<<a2+b2+c2+d2+e2<<endl;}
if(s=num3)
{cout<<num3<<" "<<name3<<" "<<sex3<<" "<<a3+b3+c3+d3+e3<<endl;}
if(s=num4)
{cout<<num4<<" "<<name4<<" "<<sex4<<" "<<a4+b4+c4+d4+e4<<endl;}
if(s=num5)
{cout<<num5<<" "<<name5<<" "<<sex5<<" "<<a5+b5+c5+d5+e5<<endl;}
if(s=num6)
{cout<<num6<<" "<<name6<<" "<<sex6<<" "<<a6+b6+c6+d6+e6<<endl;}
if(s=num7)
{cout<<num7<<" "<<name7<<" "<<sex7<<" "<<a7+b7+c7+d7+e7<<endl;}
if(s=num8)
{cout<<num8<<" "<<name8<<" "<<sex8<<" "<<a8+b8+c8+d8+e8<<endl;}

else cout<<"学号错误:"<<endl;}
 return 0;
 }
2007-11-30 14:43
lovely123
Rank: 1
等 级:新手上路
帖 子:19
专家分:0
注 册:2007-11-29
得分:0 
直接没有上过几节课,后来自己看书看不懂
你帮我搞下吧!
2007-12-01 09:28
lovely123
Rank: 1
等 级:新手上路
帖 子:19
专家分:0
注 册:2007-11-29
得分:0 
谢谢了,我再试试去!
如果你有QQ 的话我加你,以后可能有很多问题要请教呢
2007-12-01 16:44



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-189297-1-1.html




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

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