CSEC


Submit solution

Points: 10
Time limit: 1999.0s
Memory limit: 64M

Author:
Problem type
Allowed languages
C++

Aim: Define a class "student" with data members as roll_no (type int), total mark (type float), two member functions getdetails() for the student details and printdetails() for displaying the student details. Create an object for student class.

Sample Input: 12 45.5 Sample Output: 12 45.5


Comments


  • 0
    CBENU4CSE21167  commented on Jan. 8, 2023, 9:33 p.m.

    include <iostream>

    using namespace std;

    class Student{ public: int roll_no; float mark;

    public: void getdetails(){ cin >> roll_no; cin >> mark; }

    void printdetails(){ cout << roll_no << " " << mark; } };

    int main(){ Student s1; s1.getdetails(); s1.printdetails();

    return 0; }