C++ Program for declaration of member functions inside class

#include<iostream.h>
#include<conio.h>

class student
{
Private:
int rollno;
char name[20];
int marks;
Public:
void read_data();
void display();
}
void read_data()
{
cout<<"Enter rollNo"<<endl;
cin>>rollno;
cout<<"Enter name"<<endl;
cin>>name;
cout<<"Enter marks"<<endl;
cin>>marks;
}

void display()
{
cout<<"roll no="<<rollno<<endl;
cout<<"name="<<name<<endl;
cout<<"marks="<<marks<<endl;
}

int main()
{
student s;
s.read_data();
s.display();
}

This program is erroring out for me. I checked and saw that it seems to be correct. Please could you help me out and let me know if something is wrong in this?
I did not look through all your code but at least you shall change Private to private and Public to public.
The class definition shall be ended with a semicolon. Member function definitions shall include the name of the class before their own names.
Last edited on
1
2
void stident::read_data()
void student::display()
Topic archived. No new replies allowed.