标题:求助一下高手
取消只看楼主
surivering
Rank: 1
等 级:新手上路
帖 子:17
专家分:0
注 册:2005-3-5
 问题点数:0 回复次数:0 
求助一下高手
#include<iostream.h>
#include<string.h>
class student
{private:char *Name;
         int Number;
         int Mathscore;      
   int Engscore;
   int Physcore;
   int Cplusscore;
public:void registers(char *name,int number,int mathscore,int engscore,int physcore,int cplusscore)
   {strcpy(Name,name);
    Number=number;
    Mathscore=mathscore;
    Engscore=engscore;
    Physcore=physcore;
    Cplusscore=cplusscore;
   }
   void print()
   {cout<<"你的名字是:"<<Name<<endl;
    cout<<"学号是:"<<Number;
    cout<<"你的各门分数分别是:"<<"数学:"<<Mathscore<<",英语:"<<Engscore<<",物理:"<<Physcore<<",c++:"<<Cplusscore<<endl;
};};
void main(void)
{student surivering;
         surivering.registers("李明",041630,80,80,80,80);
   surivering.print();}
程序编译通过了,执行时有错误,我觉得是因为我的*name 指针没有初始化,应该怎么初始化啊
搜索更多相关主题的帖子: registers private include public number 
2005-04-21 15:19



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




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

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