Search This Blog

Loading...

C program to explain the concept of Class and Object used in C++ giving suitable example.

#include<iostram.h>
class students
{
    public:
        char *Name;
        int RollNo;
        float CPI;
        int Semester;
}
main()
{
    students st;
    st.Name = "Samir";
    st.RollNo = 1;
    st.CPI = 8.5;
    st.Semester = 8;
    cout << "\n Student Name : " << st.Name;
    cout << "\n Student Roll No : " << st.RollNo;
    cout << "\n Student CPI : " << st.CPI;
    cout << "\n Student Semester : " << st.Semester;
}

No comments:

Post a Comment