A<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://cppe.ru/index.php?action=history&amp;feed=atom&amp;title=C%2FData_Structure_Algorithm%2FTree</id>
		<title>C/Data Structure Algorithm/Tree - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://cppe.ru/index.php?action=history&amp;feed=atom&amp;title=C%2FData_Structure_Algorithm%2FTree"/>
		<link rel="alternate" type="text/html" href="http://cppe.ru/index.php?title=C/Data_Structure_Algorithm/Tree&amp;action=history"/>
		<updated>2026-04-09T12:15:08Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://cppe.ru/index.php?title=C/Data_Structure_Algorithm/Tree&amp;diff=242&amp;oldid=prev</id>
		<title> в 14:20, 25 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://cppe.ru/index.php?title=C/Data_Structure_Algorithm/Tree&amp;diff=242&amp;oldid=prev"/>
				<updated>2010-05-25T14:20:56Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 14:20, 25 мая 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
			</entry>

	<entry>
		<id>http://cppe.ru/index.php?title=C/Data_Structure_Algorithm/Tree&amp;diff=243&amp;oldid=prev</id>
		<title>Admin: 1 версия:&amp;#32;Импорт контента...</title>
		<link rel="alternate" type="text/html" href="http://cppe.ru/index.php?title=C/Data_Structure_Algorithm/Tree&amp;diff=243&amp;oldid=prev"/>
				<updated>2010-05-25T10:22:29Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия: Импорт контента...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Basics of a family tree==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
Beginning C, Third Edition&lt;br /&gt;
 By Ivor Horton&lt;br /&gt;
 ISBN: 1-59059-253-0&lt;br /&gt;
 Published: Apr 2004&lt;br /&gt;
 Publisher: apress&lt;br /&gt;
*/&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include &amp;lt;ctype.h&amp;gt;&lt;br /&gt;
#include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;
#include &amp;lt;string.h&amp;gt;&lt;br /&gt;
struct Family *get_person(void);    /* Prototype for input function */&lt;br /&gt;
char related(struct Family *pmember1, struct Family *pmember2);&lt;br /&gt;
char set_ancestry(struct Family *pmember1, struct Family *pmember2);&lt;br /&gt;
struct Date   &lt;br /&gt;
{&lt;br /&gt;
  int day;&lt;br /&gt;
  int month;&lt;br /&gt;
  int year;&lt;br /&gt;
};&lt;br /&gt;
struct Family                      /* Family structure declaration   */&lt;br /&gt;
{&lt;br /&gt;
  struct Date dob;&lt;br /&gt;
  char name[20];&lt;br /&gt;
  char father[20];&lt;br /&gt;
  char mother[20];&lt;br /&gt;
  struct Family *next;            /* Pointer to next structure      */&lt;br /&gt;
  struct Family *previous;        /* Pointer to previous structure  */&lt;br /&gt;
  struct Family *p_to_pa;         /* Pointer to father structure   */&lt;br /&gt;
  struct Family *p_to_ma;         /* Pointer to mother structure   */&lt;br /&gt;
};&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
   struct Family *first = NULL;    /* Pointer to first person        */&lt;br /&gt;
   struct Family *current = NULL;  /* Pointer to current person      */&lt;br /&gt;
   struct Family *last = NULL;     /* Pointer to previous person     */&lt;br /&gt;
   &lt;br /&gt;
   char more = &amp;quot;\0&amp;quot;;               /* Test value for ending input    */&lt;br /&gt;
   for( ; ; )&lt;br /&gt;
   {&lt;br /&gt;
     printf(&amp;quot;\nDo you want to enter details of a%s person (Y or N)? &amp;quot;, &lt;br /&gt;
                                        first != NULL?&amp;quot;nother &amp;quot; : &amp;quot;&amp;quot; );&lt;br /&gt;
     scanf(&amp;quot; %c&amp;quot;, &amp;amp;more);&lt;br /&gt;
     if(tolower(more) == &amp;quot;n&amp;quot;) &lt;br /&gt;
       break;&lt;br /&gt;
     current = get_person();&lt;br /&gt;
     if(first == NULL)&lt;br /&gt;
     {&lt;br /&gt;
       first = current;            /* Set pointer to first Family    */&lt;br /&gt;
       last = current;             /* Remember for next iteration    */&lt;br /&gt;
     }&lt;br /&gt;
     else&lt;br /&gt;
     {&lt;br /&gt;
       last-&amp;gt;next = current;  /* Set next address for previous Family */  &lt;br /&gt;
       current-&amp;gt;previous = last; /* Set previous address for current */&lt;br /&gt;
       last = current;           /* Remember for next iteration */             &lt;br /&gt;
     }&lt;br /&gt;
   }&lt;br /&gt;
   current = first;&lt;br /&gt;
   while(current-&amp;gt;next != NULL)  /* Check for relation for each person in    */&lt;br /&gt;
   {                       /* the list up to second to last            */&lt;br /&gt;
     int parents = 0;      /* Declare parent count local to this block */&lt;br /&gt;
     last = current-&amp;gt;next; /* Get the pointer to the next              */&lt;br /&gt;
     while(last != NULL)   /* This loop tests current person           */&lt;br /&gt;
     {                     /* against all the remainder in the list    */&lt;br /&gt;
       if(related(current, last))         /* Found a parent ?          */&lt;br /&gt;
         if(++parents == 2)   /* Yes, update count and check it        */&lt;br /&gt;
           break;             /* Exit inner loop if both parents found */&lt;br /&gt;
       last = last-&amp;gt;next;     /* Get the address of the next           */&lt;br /&gt;
     } &lt;br /&gt;
     current = current-&amp;gt;next;   /* Next in the list to check             */&lt;br /&gt;
   }&lt;br /&gt;
   /* Now tell them what we know */&lt;br /&gt;
   /* Output Family data in correct order */&lt;br /&gt;
   current = first;&lt;br /&gt;
   while (current != NULL)  /* Output Family data in correct order  */&lt;br /&gt;
   {&lt;br /&gt;
     printf(&amp;quot;\n%s was born %d/%d/%d, and has %s and %s as parents.&amp;quot;,&lt;br /&gt;
                  current-&amp;gt;name, current-&amp;gt;dob.day, current-&amp;gt;dob.month,&lt;br /&gt;
               current-&amp;gt;dob. year, current-&amp;gt;father,  current-&amp;gt;mother);&lt;br /&gt;
     if(current-&amp;gt;p_to_pa != NULL )&lt;br /&gt;
       printf(&amp;quot;\n\t%s&amp;quot;s birth date is %d/%d/%d  &amp;quot;,&lt;br /&gt;
                current-&amp;gt;father, current-&amp;gt;p_to_pa-&amp;gt;dob.day,&lt;br /&gt;
                               current-&amp;gt;p_to_pa-&amp;gt;dob.month, &lt;br /&gt;
                               current-&amp;gt;p_to_pa-&amp;gt;dob.year);&lt;br /&gt;
     if(current-&amp;gt;p_to_ma != NULL)&lt;br /&gt;
       printf(&amp;quot;and %s&amp;quot;s birth date is %d/%d/%d.\n  &amp;quot;,&lt;br /&gt;
                current-&amp;gt;mother, current-&amp;gt;p_to_ma-&amp;gt;dob.day,&lt;br /&gt;
                               current-&amp;gt;p_to_ma-&amp;gt;dob.month, &lt;br /&gt;
                               current-&amp;gt;p_to_ma-&amp;gt;dob.year);&lt;br /&gt;
     current = current-&amp;gt;next;  /* current points to next in list       */&lt;br /&gt;
   }&lt;br /&gt;
   /* Now free the memory */  &lt;br /&gt;
   current = first;&lt;br /&gt;
   while(current-&amp;gt;next != NULL)&lt;br /&gt;
   {&lt;br /&gt;
     last = current;     /* Save pointer to enable memory to be freed */&lt;br /&gt;
     current = current-&amp;gt;next; /* current points to next in list       */&lt;br /&gt;
     free(last);         /* Free memory for last                      */&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
/*   Function to input data on Family members   */&lt;br /&gt;
struct Family *get_person(void)&lt;br /&gt;
{&lt;br /&gt;
   struct Family *temp;         /* Define temporary structure pointer */&lt;br /&gt;
   /* Allocate memory for a structure */&lt;br /&gt;
   temp = (struct Family*) malloc(sizeof(struct Family));&lt;br /&gt;
   printf(&amp;quot;\nEnter the name of the person: &amp;quot;);&lt;br /&gt;
   scanf(&amp;quot;%s&amp;quot;, temp -&amp;gt; name );         /* Read the Family&amp;quot;s name */&lt;br /&gt;
   printf(&amp;quot;\nEnter %s&amp;quot;s date of birth (day month year); &amp;quot;, temp-&amp;gt;name);&lt;br /&gt;
   scanf(&amp;quot;%d %d %d&amp;quot;, &amp;amp;temp-&amp;gt;dob.day, &amp;amp;temp-&amp;gt;dob.month, &amp;amp;temp-&amp;gt;dob.year);&lt;br /&gt;
   printf(&amp;quot;\nWho is %s&amp;quot;s father? &amp;quot;, temp-&amp;gt;name );&lt;br /&gt;
   scanf(&amp;quot;%s&amp;quot;, temp-&amp;gt;father );        /* Get the father&amp;quot;s name */&lt;br /&gt;
 &lt;br /&gt;
   printf(&amp;quot;\nWho is %s&amp;quot;s mother? &amp;quot;, temp -&amp;gt; name );&lt;br /&gt;
   scanf(&amp;quot;%s&amp;quot;, temp -&amp;gt; mother );      /* Get the mother&amp;quot;s name */&lt;br /&gt;
 &lt;br /&gt;
   temp-&amp;gt;next = temp-&amp;gt;previous = NULL; /* Set pointers to NULL */&lt;br /&gt;
   temp-&amp;gt;p_to_pa = temp-&amp;gt;p_to_ma = NULL;    /* Set pointers to NULL  */&lt;br /&gt;
   return temp;          /* Return address of Family structure */&lt;br /&gt;
}&lt;br /&gt;
char set_ancestry(struct Family *pmember1, struct Family *pmember2)&lt;br /&gt;
{&lt;br /&gt;
   if(strcmp(pmember1-&amp;gt;father, pmember2-&amp;gt;name) == 0)&lt;br /&gt;
   {&lt;br /&gt;
     pmember1-&amp;gt;p_to_pa = pmember2;&lt;br /&gt;
     return 1;&lt;br /&gt;
   }&lt;br /&gt;
   if( strcmp(pmember1-&amp;gt;mother, pmember2-&amp;gt;name) == 0)&lt;br /&gt;
   {&lt;br /&gt;
     pmember1-&amp;gt;p_to_ma = pmember2;&lt;br /&gt;
     return 1;&lt;br /&gt;
   }&lt;br /&gt;
   else&lt;br /&gt;
     return 0;&lt;br /&gt;
}&lt;br /&gt;
/* Fill in pointers for mother or father relationships */&lt;br /&gt;
char related (struct Family *pmember1, struct Family *pmember2)&lt;br /&gt;
{&lt;br /&gt;
   return set_ancestry(pmember1, pmember2) ||&lt;br /&gt;
                           set_ancestry(pmember2, pmember1);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Basics of a family tree 2==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include &amp;lt;ctype.h&amp;gt;&lt;br /&gt;
#include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;
struct Cat *getCat(void);&lt;br /&gt;
struct Date&lt;br /&gt;
{&lt;br /&gt;
   int day;&lt;br /&gt;
   int month;&lt;br /&gt;
   int year;&lt;br /&gt;
};&lt;br /&gt;
struct Cat&lt;br /&gt;
{&lt;br /&gt;
   struct Date dob;&lt;br /&gt;
   char name[20];&lt;br /&gt;
   char father[20];&lt;br /&gt;
   char mother[20];&lt;br /&gt;
   struct Cat *next;&lt;br /&gt;
   struct Cat *previous;&lt;br /&gt;
};&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
   struct Cat *first = NULL;&lt;br /&gt;
   struct Cat *current = NULL;&lt;br /&gt;
   struct Cat *last = NULL;&lt;br /&gt;
   char more = &amp;quot;\0&amp;quot;;&lt;br /&gt;
   int i =0;&lt;br /&gt;
   for(i =0;i&amp;lt;5 ;i++ )&lt;br /&gt;
   {&lt;br /&gt;
     current = getCat();&lt;br /&gt;
     if(first == NULL){&lt;br /&gt;
       first = current;&lt;br /&gt;
       last = current;&lt;br /&gt;
     }else {&lt;br /&gt;
       last-&amp;gt;next = current;&lt;br /&gt;
       current-&amp;gt;previous = last;&lt;br /&gt;
       last = current;&lt;br /&gt;
     }&lt;br /&gt;
   }&lt;br /&gt;
   while (current  != NULL)&lt;br /&gt;
   {&lt;br /&gt;
     printf(&amp;quot;\n%s was born %d/%d/%d, and has %s and %s as parents.&amp;quot;,&lt;br /&gt;
              current-&amp;gt;name, current-&amp;gt;dob.day, current-&amp;gt;dob.month,&lt;br /&gt;
              current-&amp;gt;dob. year, current-&amp;gt;father,  current-&amp;gt;mother );&lt;br /&gt;
     last = current;     /* Save pointer to enable memory to be freed */&lt;br /&gt;
     current = current-&amp;gt;previous;  /* current points to previous list */&lt;br /&gt;
     free(last);&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
struct Cat *getCat(void)&lt;br /&gt;
{&lt;br /&gt;
   struct Cat *temp;&lt;br /&gt;
   temp = (struct Cat*) malloc(sizeof(struct Cat));&lt;br /&gt;
   printf(&amp;quot;\nEnter the name of the person: &amp;quot;);&lt;br /&gt;
   scanf(&amp;quot;%s&amp;quot;, temp -&amp;gt; name );&lt;br /&gt;
   printf(&amp;quot;\nEnter %s&amp;quot;s date of birth (day month year); &amp;quot;, temp-&amp;gt;name);&lt;br /&gt;
   scanf(&amp;quot;%d %d %d&amp;quot;, &amp;amp;temp-&amp;gt;dob.day, &amp;amp;temp-&amp;gt;dob.month, &amp;amp;temp-&amp;gt;dob.year);&lt;br /&gt;
   printf(&amp;quot;\nWho is %s&amp;quot;s father? &amp;quot;, temp-&amp;gt;name );&lt;br /&gt;
   scanf(&amp;quot;%s&amp;quot;, temp-&amp;gt;father );&lt;br /&gt;
   printf(&amp;quot;\nWho is %s&amp;quot;s mother? &amp;quot;, temp -&amp;gt; name );&lt;br /&gt;
   scanf(&amp;quot;%s&amp;quot;, temp -&amp;gt; mother );&lt;br /&gt;
   temp-&amp;gt;next = temp-&amp;gt;previous = NULL;&lt;br /&gt;
   return temp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Displays a binary tree==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
C: The Complete Reference, 4th Ed. (Paperback)&lt;br /&gt;
by Herbert Schildt&lt;br /&gt;
ISBN: 0072121246&lt;br /&gt;
Publisher: McGraw-Hill Osborne Media; 4 edition (April 26, 2000)&lt;br /&gt;
*/&lt;br /&gt;
/* This program displays a binary tree. */&lt;br /&gt;
#include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
struct tree {&lt;br /&gt;
  char info;&lt;br /&gt;
  struct tree *left;&lt;br /&gt;
  struct tree *right;&lt;br /&gt;
};&lt;br /&gt;
struct tree *root; /* first node in tree */&lt;br /&gt;
struct tree *stree(struct tree *root,&lt;br /&gt;
                   struct tree *r, char info);&lt;br /&gt;
void print_tree(struct tree *root, int l);&lt;br /&gt;
int main(void)&lt;br /&gt;
{&lt;br /&gt;
  char s[80];&lt;br /&gt;
  root = NULL;  /* initialize the root */&lt;br /&gt;
  do {&lt;br /&gt;
    printf(&amp;quot;Enter a letter: &amp;quot;);&lt;br /&gt;
    gets(s);&lt;br /&gt;
    root = stree(root, root, *s);&lt;br /&gt;
  } while(*s);&lt;br /&gt;
  print_tree(root, 0);&lt;br /&gt;
  return 0;&lt;br /&gt;
}&lt;br /&gt;
struct tree *stree(&lt;br /&gt;
  struct tree *root,&lt;br /&gt;
  struct tree *r,&lt;br /&gt;
  char info)&lt;br /&gt;
{&lt;br /&gt;
  if(!r) {&lt;br /&gt;
    r = (struct tree *) malloc(sizeof(struct tree));&lt;br /&gt;
    if(!r) {&lt;br /&gt;
      printf(&amp;quot;Out of Memory\n&amp;quot;);&lt;br /&gt;
      exit(0);&lt;br /&gt;
    }&lt;br /&gt;
    r-&amp;gt;left = NULL;&lt;br /&gt;
    r-&amp;gt;right = NULL;&lt;br /&gt;
    r-&amp;gt;info = info;&lt;br /&gt;
    if(!root) return r; /* first entry */&lt;br /&gt;
    if(info &amp;lt; root-&amp;gt;info) root-&amp;gt;left = r;&lt;br /&gt;
    else root-&amp;gt;right = r;&lt;br /&gt;
    return r;&lt;br /&gt;
  }&lt;br /&gt;
  if(info &amp;lt; r-&amp;gt;info)&lt;br /&gt;
    stree(r, r-&amp;gt;left, info);&lt;br /&gt;
  else&lt;br /&gt;
    stree(r, r-&amp;gt;right, info);&lt;br /&gt;
  return root;&lt;br /&gt;
}&lt;br /&gt;
void print_tree(struct tree *r, int l)&lt;br /&gt;
{&lt;br /&gt;
  int i;&lt;br /&gt;
  if(!r) return;&lt;br /&gt;
  print_tree(r-&amp;gt;right, l+1);&lt;br /&gt;
  for(i=0; i&amp;lt;l; ++i) printf(&amp;quot; &amp;quot;);&lt;br /&gt;
  printf(&amp;quot;%c\n&amp;quot;, r-&amp;gt;info);&lt;br /&gt;
  print_tree(r-&amp;gt;left, l+1);&lt;br /&gt;
}&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Investigating the family==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
Beginning C, Third Edition&lt;br /&gt;
 By Ivor Horton&lt;br /&gt;
 ISBN: 1-59059-253-0&lt;br /&gt;
 Published: Apr 2004&lt;br /&gt;
 Publisher: apress&lt;br /&gt;
*/&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include &amp;lt;ctype.h&amp;gt;&lt;br /&gt;
#include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;
#include &amp;lt;string.h&amp;gt;&lt;br /&gt;
char myfile[] = &amp;quot;C:\\myfile.bin&amp;quot;; /* Physical file name      */&lt;br /&gt;
FILE *pfile = NULL;               /* File pointer            */&lt;br /&gt;
struct Date                       /* Structure for a date    */&lt;br /&gt;
{&lt;br /&gt;
   int day;&lt;br /&gt;
   int month;&lt;br /&gt;
   int year;&lt;br /&gt;
};&lt;br /&gt;
typedef struct family        /* Family structure declaration */&lt;br /&gt;
{&lt;br /&gt;
   struct Date dob;&lt;br /&gt;
   char name[20];&lt;br /&gt;
   char pa_name[20];&lt;br /&gt;
   char ma_name[20];&lt;br /&gt;
}Family;&lt;br /&gt;
/* Function prototypes */&lt;br /&gt;
int get_person(Family *pfamily);       /* Input function           */&lt;br /&gt;
void show_person_data(void);           /* Output function          */&lt;br /&gt;
void get_parent_dob(Family *pfamily);  /* Function to find pa &amp;amp; ma */&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
   Family member;                      /* Stores a family structure */&lt;br /&gt;
   Family *pmember = &amp;amp;member;     /* Points to the family structure */&lt;br /&gt;
   if((pfile = fopen(myfile, &amp;quot;wb&amp;quot;)) == NULL)&lt;br /&gt;
   {&lt;br /&gt;
     printf(&amp;quot;\nUnable to open %s for writing.\n&amp;quot;, myfile);&lt;br /&gt;
     abort();&lt;br /&gt;
   }&lt;br /&gt;
   while(get_person(pmember))           /* As long as we have input */&lt;br /&gt;
     fwrite(pmember, sizeof member, 1, pfile);  /*    write it away */&lt;br /&gt;
   fclose(pfile);                 /* Close the file now its written */&lt;br /&gt;
   show_person_data();            /* Show what we can find out      */&lt;br /&gt;
   if(remove(myfile))&lt;br /&gt;
     printf(&amp;quot;\nUnable to delete %s.\n&amp;quot;, myfile);&lt;br /&gt;
   else&lt;br /&gt;
     printf(&amp;quot;\nDeleted %s OK.\n&amp;quot;, myfile);&lt;br /&gt;
}&lt;br /&gt;
/* Function to input data on Family members */&lt;br /&gt;
int get_person( Family *temp)&lt;br /&gt;
{&lt;br /&gt;
   static char more = &amp;quot;\0&amp;quot;;    /* Test value for ending input */&lt;br /&gt;
   printf(&amp;quot;\nDo you want to enter details of a%s person (Y or N)? &amp;quot;,&lt;br /&gt;
                                       more != &amp;quot;\0&amp;quot;?&amp;quot;nother &amp;quot; : &amp;quot;&amp;quot; );&lt;br /&gt;
   scanf(&amp;quot; %c&amp;quot;, &amp;amp;more);&lt;br /&gt;
   if(tolower(more) == &amp;quot;n&amp;quot;) &lt;br /&gt;
          return 0;&lt;br /&gt;
   printf(&amp;quot;\nEnter the name of the person: &amp;quot;);&lt;br /&gt;
   scanf(&amp;quot;%s&amp;quot;, temp-&amp;gt;name);         /* Read the Family&amp;quot;s name */&lt;br /&gt;
   printf(&amp;quot;\nEnter %s&amp;quot;s date of birth (day month year); &amp;quot;, temp-&amp;gt;name);&lt;br /&gt;
   scanf(&amp;quot;%d %d %d&amp;quot;, &amp;amp;temp-&amp;gt;dob.day, &amp;amp;temp-&amp;gt;dob.month, &amp;amp;temp-&amp;gt;dob.year);&lt;br /&gt;
   printf(&amp;quot;\nWho is %s&amp;quot;s father? &amp;quot;, temp-&amp;gt;name);&lt;br /&gt;
   scanf(&amp;quot;%s&amp;quot;, temp-&amp;gt;pa_name);      /* Get the father&amp;quot;s name  */&lt;br /&gt;
   printf(&amp;quot;\nWho is %s&amp;quot;s mother? &amp;quot;, temp-&amp;gt;name);&lt;br /&gt;
   scanf(&amp;quot;%s&amp;quot;, temp-&amp;gt;ma_name);      /* Get the mother&amp;quot;s name  */&lt;br /&gt;
   return 1;&lt;br /&gt;
}&lt;br /&gt;
/* Function to output data on people on file   */&lt;br /&gt;
void show_person_data(void)&lt;br /&gt;
{&lt;br /&gt;
   Family member;             /* Structure to hold data from file  */&lt;br /&gt;
   Family *pmember = &amp;amp;member; /* Pointer to Family structure       */&lt;br /&gt;
   fpos_t current = 0;        /* File position                     */&lt;br /&gt;
   pfile = fopen(myfile, &amp;quot;rb&amp;quot;); /* Open file for binary read  */&lt;br /&gt;
   /* Read data on person */&lt;br /&gt;
   while(fread(pmember, sizeof member, 1, pfile))   &lt;br /&gt;
   {&lt;br /&gt;
     fgetpos(pfile, &amp;amp;current);  /* Save current position      */&lt;br /&gt;
     printf(&amp;quot;\n\n%s&amp;quot;s father is %s, and mother is %s.&amp;quot;,&lt;br /&gt;
              pmember-&amp;gt;name, pmember-&amp;gt;pa_name, pmember-&amp;gt;ma_name);&lt;br /&gt;
     get_parent_dob(pmember);   /* Get parent data            */&lt;br /&gt;
     fsetpos(pfile, &amp;amp;current);  /* Position file to read next */&lt;br /&gt;
   }&lt;br /&gt;
    fclose(pfile);              /* Close the file             */&lt;br /&gt;
}&lt;br /&gt;
/* Function to find parents&amp;quot; dates of birth. */&lt;br /&gt;
void get_parent_dob(Family *pmember)&lt;br /&gt;
{&lt;br /&gt;
   Family testmem;             /* Stores a relative         */&lt;br /&gt;
   Family *ptestmem = &amp;amp;testmem; /* Pointer to the relative   */&lt;br /&gt;
   int num_found = 0;           /* Count of relatives found  */&lt;br /&gt;
   rewind(pfile);               /* Set file to the beginning */&lt;br /&gt;
   /* Get the stuff on a relative */&lt;br /&gt;
   while(fread(ptestmem, sizeof(Family), 1, pfile))&lt;br /&gt;
   {&lt;br /&gt;
     if(strcmp(pmember-&amp;gt;pa_name, ptestmem-&amp;gt;name) == 0)   /*Is it pa? */&lt;br /&gt;
     { /* We have found dear old dad */&lt;br /&gt;
       printf(&amp;quot;\n Pa was born on %d/%d/%d.&amp;quot;,&lt;br /&gt;
             ptestmem-&amp;gt;dob.day, ptestmem-&amp;gt;dob.month, ptestmem-&amp;gt;dob.year);  &lt;br /&gt;
 &lt;br /&gt;
       if(++num_found == 2)    /* Increment parent count    */&lt;br /&gt;
         return;               /* We got both so go home    */&lt;br /&gt;
     }&lt;br /&gt;
     else&lt;br /&gt;
       if(strcmp(pmember-&amp;gt;ma_name, ptestmem-&amp;gt;name) == 0) /*Is it ma? */&lt;br /&gt;
       { /* We have found dear old ma */&lt;br /&gt;
         printf(&amp;quot;\n Ma was born on %d/%d/%d.&amp;quot;,&lt;br /&gt;
                ptestmem-&amp;gt;dob.day, ptestmem-&amp;gt;dob.month, ptestmem-&amp;gt;dob.year);&lt;br /&gt;
         if(++num_found == 2)  /* Increment parent count    */&lt;br /&gt;
             return;           /* We got both so go home    */&lt;br /&gt;
       }&lt;br /&gt;
   }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>