Profile Of a student
#include<iostream>
#include<cstring>
using namespace std;
class student
{
char A[100],B[100];
int id;
char sec[100];
int age;
char gender[100];
char blood_g[100];
char semister[100];
public:
void s_name(char *m)
{
strcpy(A,m);
}
void s_name1(char *n)
{
strcpy(B,n);
}
void s_id(int k)
{
id=k;
}
void s_age(int k)
{
age=k;
}
void s_sec(char *m)
{
strcpy(sec,m);
}
void s_blood(char *m)
{
strcpy(blood_g,m);
}
void s_semister(char *n)
{
strcpy(semister,n);
}
void show()
{
cout<<"your name is : "<<A<<" ";
cout<<B<<endl;
cout<<"your id is : "<<id<<endl;
cout<<"your age is : "<<age<<endl;
cout<<"your sec is : "<<sec<<endl;
cout<<"your blood group is : "<<blood_g<<endl;
cout<<"your semister is : "<<semister<<endl;
}
};
class course
{
public:
char c_name[100];
char subject[100];
int credit;
char time[100];
void s_name(char *m)
{
strcpy(c_name,m);
}
void s_subject(char *m)
{
strcpy(subject,m);
}
void s_time(char *m)
{
strcpy(time,m);
}
void s_credit(int m)
{
credit=m;
}
void show()
{
cout<<"your course name is : "<<c_name<<endl;
cout<<"your subject is : "<<subject<<endl;
cout<<"your credit is : "<<credit<<endl;
cout<<"your time is : "<<time<<endl;}
};
class teacher
{
char tname[100];
char gende[100];
int age;
char faculty[100];
};
int main()
{
student ob1;
course ob2;
char A[100],B[100];
int i=0;
cout <<"enter your 1st name :"<<endl;
cin>>A;
ob1.s_name(A);
cout <<"enter your 2nd name :"<<endl;
cin>>B;
ob1.s_name1(B);
cout <<"enter your id :"<<endl;cin>>i;
ob1.s_id(i);
cout <<"enter your sec :"<<endl;cin>>A;
ob1.s_sec(A);
cout <<"enter your blood group :"<<endl;cin>>A;
ob1.s_blood(A);
cout <<"enter your semister :"<<endl;cin>>A;
ob1.s_semister(A);
cout <<"enter your age :"<<endl;cin>>i;
ob1.s_age(i);cout<<endl<<endl<<endl;
ob1.show();
cout<<endl<<endl<<endl;
cout <<"enter your course name :"<<endl;cin>>A;
ob2.s_name(A);cout<<endl;
cout <<"enter your credit :"<<endl;cin>>i;
ob2.s_credit(i);cout<<endl;
cout <<"enter your subject name :"<<endl;cin>>A;
ob2.s_subject(A);cout<<endl;
cout <<"enter your time shedule :"<<endl;cin>>A;
ob2.s_time(A);cout<<endl<<endl<<endl;
ob2.show();
}
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment