帮我看下,无法输出???
#include<iostream>using namespace std;
class stud{
public:
void setinformation(long x,char y);
void showinformation();
private:
long studnum;
char studsex;
};
void stud::setinformation(long x,char y){
studnum=x;
studsex=y;
}
void stud::showinformation (){
if(studnum=='g')
cout<<"mike is a girl and her studnum is:"<<studnum<<endl;
if(studnum=='b')
cout<<"mike is a boy and his studnum is:"<<studnum<<endl;
}
int main(){
stud mike;
long num;
char sex;
cout<<"input num:"<<endl;
cin>>num;
cout<<"input sex:"<<endl;
cin>>sex;
mike.setinformation(num,sex);
mike.showinformation();
return 0;
}