Q:

Write a C++ program to display Student details using class

0

Write a C++ program to display Student details using class

 

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

#include<iostream>
using namespace std;
class student
{
        private:
                
                        char name[20],regd[10],branch[10];
                        int sem;
        public:
                void input();
                void display();
                        
                
};
void student::input()
{
        cout<<"Enter Name:";
        cin>>name;
        cout<<"Enter Regdno.:";
        cin>>regd;
        cout<<"Enter Branch:";
        cin>>branch;
        cout<<"Enter Sem:";
        cin>>sem;
}
void student::display()
{
        cout<<"\nName:"<<name;
        cout<<"\nRegdno.:"<<regd;
        cout<<"\nBranch:"<<branch;
        cout<<"\nSem:"<<sem;
}
int main()
{
        student s;
        s.input();
        s.display();
}
 
 

OUTPUT ::

Enter Name:codezclub
Enter Regdno.:1
Enter Branch:ECE
Enter Sem:2

Name:codezclub
Regdno.:1
Branch:ECE
Sem:2

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

C++ Classes and Objects Solved Programs

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
Write a C++ Program to find Largest among 3 number... >>
<< Write a C++ Program to display entered Date...