CSEC
Submit solution
C++
Points:
10
Time limit:
1999.0s
Memory limit:
64M
Author:
Problem type
Allowed languages
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
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; }