C++ program to display student details using class

Write a C++ code to display student information using class and object.

#include<iostream>
using namespace std;
class Student_Details
{
        private:
                
                        char name[20],RollNo[10],Section[10];
                        int Semester;
        public:
                void input();
                void show();
                        
                
};
void Student_Details::input()
{
        cout<<"Enter Name:";
        cin>>name;
        cout<<"Enter RollNono.:";
        cin>>RollNo;
        cout<<"Enter Section:";
        cin>>Section;
        cout<<"Enter Semester:";
        cin>>Semester;
}
void Student_Details::show()
{
        cout<<"\nName:"<<name;
        cout<<"\nRollNono.:"<<RollNo;
        cout<<"\nSection:"<<Section;
        cout<<"\nSemester:"<<Semester;
}
int main()
{
        Student_Details s;
        s.input();
        s.show();
}

Output

Enter Name:Shamil
Enter RollNono.:7
Enter Section:A
Enter Semester:3

Name:Shamil
RollNono.:7
Section:A
Semester:3
————-

Prof.Fazal Rehman Shamil (Available for Professional Discussions)
1. Message on Facebook page for discussions,
2. Video lectures on Youtube
3. Email is only for Advertisement/business enquiries.