Print from a class

Hey guys i wrote this piece of code but i am now stuck because i dont know how to print the elements from my class. For example, how can i print the three elements of student s?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <iostream>
#include <map>
#include <string>
using namespace std;

 class student
 {
    public:
   student() {}
   student(string N, int I, double F)
   { name = N;
     id = I;
     gpa = F;
   }
    string name;
    int id;
    double gpa;
 };


int main()
{
    
student s("Adam Smith", 123456, 3.3);
  
system ( "PAUSE" );
  return 0;
}


Thanks for your help!
as your student members are public, you can simply access them like:

1
2
student s("Adam Smith", 123456, 3.3);
std::cout << s.name << '\n' << s.id << '\n' << s.gpa << '\n';
Topic archived. No new replies allowed.