Problem About Struct!

closed account (3A0DizwU)
I have to design a struct that holds names, ages and a pointer to the struct itself

For example:

struct couples
{
string name;
int age;
couples *spouse;
}

I have to write a program that asks user to enter 3 male and 3 female information. Then the program asks the names of the wives of the 3 men you already entered and the names are among the 3 females. The program matches those names to the corresponding structs and holds their pointers in the 'spouse' field. The program prints the name of the couples on the screen men first, wives second using only the first three male entries.

I've tried but program didnt work, thanks for your concern.

-code link-
http://pastebin.com/SyRdvZef
-code link-

Last edited on
comment your code stating your intentions.
explain why do you think that you need 4 arrays, the purpose of the `pmale' and `pfemale' pointers and how are you linking the couples.

Also, learn to indent
Topic archived. No new replies allowed.