Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Using the structures parent(X,Y), male(X), and female(X), write
structures that define father(X,Y), mother(X,Y), brother(X,Y),
sister(X,Y), grandparent(X,Y), and grandmother(X,Y).


What I have tried:

father_of(Father,Child) and mother_of(Mother,Child)
grandfather_of(Grandfather,Child) and grandmother_of(Grandmother,Child)
sister_of(Sister,Person)
aunt_of(Aunt,Person) and uncle_of(Uncle,Person)
Posted
Updated 21-Jun-20 9:44am
Comments
Richard MacCutchan 21-Jun-20 7:07am    
Where is the code that you have written?
OriginalGriff 21-Jun-20 7:17am    
Code?
Written?
That's for the old folk ... we young 'uns just copy'n'paste ...

:sigh:
Richard MacCutchan 21-Jun-20 7:26am    
Seems to get more true every day.

Quote:
How do I this problem

If you can't really workout anything, you should have a talk with your teacher/mentor.

You show no attempt to solve the problem yourself, you have no question, your main effort is pasting the requirement, you just want us to do your HomeWork.
HomeWork problems are simplified versions of the kind of problems you will have to solve in real life, their purpose is learning and practicing.

We do not do your HomeWork.
HomeWork is not set to test your skills at begging other people to do your work, it is set to make you think and to help your teacher to check your understanding of the courses you have taken and also the problems you have at applying them.
Any failure of you will help your teacher spot your weaknesses and set remedial actions.
Any failure of you will help you to learn what works and what don't, it is called 'trial and error' learning.
So, give it a try, reread your lessons and start working. If you are stuck on a specific problem, show your code and explain this exact problem, we might help.
 
Share this answer
 
We are more than willing to help those that are stuck: but that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you.

So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!
Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.
 
Share this answer
 
You will need to learn the language from some tutorial like Learn C++.

I wonder about using structures and not classes. Maybe you read carefully your assigment.

What have you really tried?
 
Share this answer
 
It's all about relationships - the "is a" relationship and the "have a" relationship. A person IS A male or a female and they HAVE parents and siblings. A parent's parent is a grandparent. A parent's sibling is an aunt or uncle. If only biology is considered, they have two parents and numerous siblings. From there, you should be able to define the rest. I would assume relationships are defined through pointers.

The "IS A" relationship implies inheritance and derivation while the "HAVE A" relation implies data membership.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900