fork download
  1. //Program to find the classes and objects
  2. #include <iostream>
  3. using namespace std;
  4. class student{
  5. char *name;
  6. long int reg_no;
  7. float per;
  8. int age,standard;
  9. public:
  10. void input_data()
  11. {
  12. cout<<"Enter name, registration number, percentage, age, standard of student"<<endl;
  13. name="Shachi Gupta";
  14. cin>>reg_no>>per>>age>>standard;
  15. }
  16. void show_data()
  17. {
  18. cout<<"Name:"<<name<<"\nRegistration number:"<<reg_no<<"\npercentage"<<per<<"\nAge:"<<age<<"\nStandard:"<<standard;
  19. }
  20. };
  21. int main() {
  22. // your code goes here
  23. student s1;
  24. s1.input_data();
  25. s1.show_data();
  26. return 0;
  27. }
Success #stdin #stdout 0s 5368KB
stdin
12105141
92.90
19
1
stdout
Enter name, registration number, percentage, age, standard of student
Name:Shachi Gupta
Registration number:12105141
percentage92.9
Age:19
Standard:1