C++
#include <iostream>
#include "student.h"
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char** argv)
{
student s1;
s1.set_value();
s1.display();
return 0;
}
#include "student.h"
<pre name="code" class="cpp">#include <iostream>
using namespace std;
void student::display(){cout<<"num="<<num<<endl;cout<<"name="<<name<<endl;cout<<"sex="<<sex<<endl;}void student::set_value(){cin>>num;cin>>name;cin>>sex;}
#ifndef STUDENT_H
#define STUDENT_H
class student
{
private:
int num;
string name;
char sex;
public:
void display();
void set_value();
};
#endif