Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- class student
- {
- private:
- string name;
- int age;
- float cgpa;
- char dept;
- public:
- int set_student_info(string a,int b,float c,char d)
- {
- name=a;
- age=b;
- cgpa=c;
- dept=d;
- }
- int view_all_info()
- {
- cout<<endl;
- cout<<"name:"<<name<<endl;
- cout<<"age:"<<age<<endl;
- cout<<"cgpa:"<<cgpa<<endl;
- cout<<"dept:"<<dept<<endl;
- }
- };
- int main()
- {
- student s1;
- s1.set_student_info ("student cse",21,3.69,'c');
- s1.view_all_info();
- student s2;
- s2.set_student_info ("student EEE",20,3.65,'eee');
- s2.view_all_info();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement