Tuesday, 13 September 2016

Hacker Rank Solution Program In C++ For " Structs "

Problem :- Hacker Rank Solution Program In C++ For " Structs "
struct can be represented as


struct NewType {

type1 value1;

type2 value2;
.
.
.
typeN valueN;

};

You have to create a struct, named Student, representing the student's details, as mentioned above, and store the data of a student.

Solution :-

#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;

struct Student
{
int age,standard;
string first_name,last_name;
};

int main() {
Student st;
cin >> st.age >> st.first_name >> st.last_name >> st.standard;
cout << st.age << " " << st.first_name << " " << st.last_name << " " << st.standard;
return 0;
}


Output :-


Hacker Rank Solution Program In C++ For " Structs "


Hacker Rank Solution Program In C++ For " Structs "


No comments:
Write comments

Recommended Posts × +