| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 423 人关注过本帖
标题:c++学生管理系统问题
只看楼主 加入收藏
kbkwb
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2013-1-12
结帖率:0
收藏
已结贴  问题点数:20 回复次数:7 
c++学生管理系统问题

#include<iostream>
#include<string>
using namespace std;
class Student//这里新建一个学生类
{
public:
    string StudentName;
    int section2;
    double result;
    double StudentID;
    double StudentStore[8];
    Student()
    {
        section2=0;
    }
    void GetStudentName()
    {
        cout<<"请输入学生的姓名:";
        cin>>StudentName;

    }
    void GetStudetID()
    {
        cout<<"请输入学生的学号:";
        cin>>StudentID;
    }
    void GetStudentStore()
    {
        cout<<"语文 数学 英语 历史 地理 政治 物理 生物";

     for(;section2<8;++section2)
     {
         cin>>StudentStore[section2];
     }
    }
    void GetResult()
    {
        for(;section2<8;++section2)
      {
            result=result+StudentStore[section2];
      }
    }

    void PrintStudent()
   {
    cout<<StudentName;
    for(;section2<8;++section2)
    {
        cout<<StudentStore[section2];
    }
    cout<<"总分:"<<result<<endl;
   }
};

int main()
{
    Student*GetInformation=NULL;
    int section=0;
    int GetAmount;
    string insted("Y");
    for(;insted=="Y";)
   {
    cout << "           * * * * * * * * * * *" << endl;
            cout<<"        * 1:输入学生的信息      *"<<endl;
            cout<<"        * 2: 计算学生的总成绩    *"<<endl;
            cout<<"        * 3:输出学生的成绩       *"<<endl;
            cout<<"        * 4:寻找学生:           *"<<endl;
    cout<<"           * * * * * * * * * * * "<<endl;
    int GetNumber;
    cin>>GetNumber;

    if(GetNumber==1)
    {

        cout<<"您想要输入多少名学生:";
        cin>>GetAmount;
         GetInformation=new Student[GetAmount];
        for(;section<GetAmount;++section)
        {
            cout<<"请输入第"<<section+1;
            cout<<"的信息";
            GetInformation[section].GetStudentName();
            GetInformation[section].GetStudetID();
            GetInformation[section].GetStudentStore();
        }
    }
   else if(GetNumber==2)
    {
        Student team;
        int num1=0;
        int num2=0;
        for(;num1< GetAmount-1;++num1)
        {
            for(;num2<GetAmount-1-num1;++num2)
            {
                if(GetInformation[num2].result>GetInformation[num2+1].result)
                {
                    team=GetInformation[num2];
                    GetInformation[num2]=GetInformation[num2+1];
                    GetInformation[num2+1]=team;
                }
            }

        }
    }
    else if(GetNumber==3)
    {
        cout<<"姓名 ";
        cout<<"语文 数学 英语 历史 地理 政治 物理 生物 "<<endl;
      for(;section<GetAmount;++section)
      {
          GetInformation[section].PrintStudent();
      }
      
    }
    cout<<"完成 请输入Y/N来进行下一步操作";
    cin>>insted;
  }
    return 0;
}
这里哪儿错了  为什麽无法显示成绩呢
搜索更多相关主题的帖子: double public include void 
2013-01-12 21:16
傻傻的聪明鬼
Rank: 1
来 自:上海
等 级:等待验证会员
帖 子:8
专家分:8
注 册:2011-4-14
收藏
得分:4 
for(;section<GetAmount;++section)
{
    GetInformation[section].PrintStudent();
}

像这些循环 判断条件的变量值  应该在用的时候就初始化  最好是什么时候用什么时候去定义,   防止在其他的地方  做了改变  达不到自己的要求   
 还有  你在打印成绩的时候,   在Student类  的print方法中   输出了 总成绩,但是  你却没有去调用 定义的计算方法
很多问题  可以通过调试  得到结果的    得学会方法


不要低估一颗菜鸟的心
2013-01-12 23:42
不玩虚的
Rank: 9Rank: 9Rank: 9
来 自:四川
等 级:贵宾
威 望:10
帖 子:331
专家分:1301
注 册:2012-12-9
收藏
得分:4 
类的数据成员都弄成public:有的放弃了类的封装了吧。
编程思路有待提高!

同学习......同进步....你帮我......我帮你.....上善若水.....
2013-01-13 01:04
kbkwb
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2013-1-12
收藏
得分:0 
什么意思
2013-01-13 08:00
kbkwb
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2013-1-12
收藏
得分:0 
我还是看不懂
2013-01-13 08:01
yaobao
Rank: 13Rank: 13Rank: 13Rank: 13
等 级:蒙面侠
威 望:4
帖 子:1854
专家分:4121
注 册:2012-10-25
收藏
得分:4 
路过哦

认认真真的学习,踏踏实实的走路:戒骄戒躁!!!
2013-01-13 08:25
青春无限
Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19
来 自:江苏
等 级:贵宾
威 望:24
帖 子:3451
专家分:19340
注 册:2012-3-31
收藏
得分:4 
学习了

学 会看代码…学习写程序…学会搞开发…我的目标!呵呵是不是说大话啊!!一切皆可能
2013-01-14 06:37
锋了
Rank: 7Rank: 7Rank: 7
来 自:向日葵幼儿园
等 级:黑侠
威 望:2
帖 子:306
专家分:586
注 册:2012-10-27
收藏
得分:4 
看看
2013-01-14 20:30
快速回复:c++学生管理系统问题
数据加载中...
 
   



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

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