mardi 21 août 2018

I need an explanation on structs in C++

I had a problem to solve, but I failed to do it, so I looked at the solution and it includes something I don't fully understand. It's the following:

struct pancake
{
    int weight, radius, index;
    pancake(){};
    pancake(int W, int R, int I):weight(W),radius(R),index(I){}
};

I have worked with structs before so I get the first line of the struct very well, it holds the pancake's weight, radius and index. However, I don't understand what the second and third line of the struct mean(or do) at all. If someone could explain that I would be very grateful.

Aucun commentaire:

Enregistrer un commentaire