In this HackerRank Class problem in c++, we need to create a class, named Student, representing the student's details, and store the data of a student. Create setter and getter functions for each element.


HackerRank Class in C++ problem solution

 

HackerRank Class in C++ problem solution

#include <iostream>
#include <sstream>
using namespace std;

int main() {
    string age, standard;
    string first_name, last_name;
    
    cin >> age >> first_name >> last_name >> standard;
    
    cout << age << "\n";
    cout << last_name << ", " << first_name<< "\n";
    cout << standard << "\n";
    cout << "\n";
    cout << age<<","<<first_name<<","<<last_name<<","<<standard<<endl;
    
    return 0;
}