Advertisement
Guest User

sumon

a guest
Feb 26th, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.58 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3. class student
  4. {
  5. private:
  6. string name;
  7. int age;
  8. float cgpa;
  9. char dept;
  10.  
  11. public:
  12. int set_student_info(string a,int b,float c,char d)
  13. {
  14. name=a;
  15. age=b;
  16. cgpa=c;
  17. dept=d;
  18. }
  19. int view_all_info()
  20. {
  21. cout<<endl;
  22. cout<<"name:"<<name<<endl;
  23. cout<<"age:"<<age<<endl;
  24. cout<<"cgpa:"<<cgpa<<endl;
  25. cout<<"dept:"<<dept<<endl;
  26. }
  27.  
  28. };
  29.  
  30. int main()
  31. {
  32.     student s1;
  33.     s1.set_student_info ("student cse",21,3.69,'c');
  34.     s1.view_all_info();
  35.     student s2;
  36.     s2.set_student_info ("student EEE",20,3.65,'eee');
  37.     s2.view_all_info();
  38.  
  39.  
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement