Need Nested Struct Help

Can someone tell me what i did wrong with this code:


using namespace std;

//Represent a person
//1. Name
//2. Age
//3. Gender

struct Person{

string name;
int age;
string gender;


struct Marriage{
Person personA;
Person personB;
int ageOfMarrige;
int numberOfPeopleAtWedding;


void printPersonInfo(Person p) {
cout << "The name of the person is "<<<<endl;
cout << "The age of the person is "<<p.age<<endl;
cout << "The gender of the person is "<<p.gender<<endl;

void printMarriageInfo(Marriage m){
cout << << " married "<< <<endl;
cout << " They have been married for "<< m.ageOfMarrige << " Number of years "<<endl;
cout << m.numberOfPeopleAtWedding << " People visited thier wedding "<<endl;

int main()

Person david = {"David", 21, "Male"};
Person clint = {"Clint", 31, "Male"};
Person sara = {"Sara", 29, "Female"};

Marriage marriage = {ivan, sara, 20, 200};


return 0;


I followed the video on Nested Struct, but my code does not work.


You defined person david and use ivan in the struct.

Ok i got it!

Thank you!