※スタイルシート未対応ブラウザではレイアウトを正確に再現できません。
  < The returning  contents  advance >   
                   < [modosusu] > Color magazine monochrome light and shade   font predetermined, Gothic Ming-style type longhand   size Konaka large   standard  


  Exercise 20   

  1. ..clause 1..: Basic knowledge
  2. Memo
  3. ..clause 3..: Description type
  4. ..clause 4..: Basic knowledge(example solution)
  5. Memo(example solution)
  6. ..clause 6..: Description type(example solution)


[1] Basic knowledge


[  1-1  ]
What is chiefly called the file that describes the declaration?

[  1-2  ]
What is called the file where an actual program is described?
Example solution

It returns to contents.


Memo


[  2-1  ]
 

void InputPeople(People *data) 
{
	Printf ("Name");
	scanf("%s",data->name); 
	Printf ("Age");
	scanf("%d",&data->age); 
	Printf ("Sex (one-..man.. two-woman)");
	scanf("%d",&data->sex); 
	printf("\n"); 
}

void ShowPeople(People data) 
{
	char sex[16]; 
	
	Printf ("Name: %s\n" data.name);
	Printf ("Age: %d\n" data.age);
	
	 Strcpy (sex "Man");
	} else { 
		Strcpy (sex "Woman");
	}
	
	Printf ("Sex: %s\n" sex);
	printf("\n"); 
}

Bring this program together in the header file and the source file.
Example solution

It returns to contents.


[3] Description type


[  3-1  ]
To operate even if all functions are described in one source file
Describe the reason purposely divided concisely.
Example solution

It returns to contents.


[4] Basic knowledge(example solution)


[  1-1  ]
Header file

[  1-2  ]
Source file
Problem

It returns to contents.


Memo(example solution)


[  2-1  ]
 
/* People.h */ #ifndef __PEOPLE_H__ #define __PEOPLE_H__ 

#include <stdio.h> 
#include <string.h> 

typedef struct { 
	char name[256]; int 
	age; 
	int sex;  
} People;  

/* */ that inputs individual data  Extern void InputPeople(People *data);  

/* */ that displays individual data  Extern void ShowPeople(People data);  

#endif 
 
/* People.c */ 

#include "People.h" 

void InputPeople(People *data)  
{
	/* Omit contents because it is the same */. 
	
}

void ShowPeople(People data)  
{
	/* Omit contents because it is the same */. 
	
}
- There are various methods in division.
  Though all # include might be done by the source file
  One in the header file regards the author. as can save time
  Extern might not be put up to the prototype declaration of the function.
  Though it follows the rule of the team when developing in the team
  The rule doesn't suit me and even if it is old-fashioned, it ..(..
  It is top priority to attempt the union of the forms. )
  Keeping deciding the method by yourself and using it might be good for the individual development.
Problem

It returns to contents.


[6] Description type(example solution)


[  3-1  ]
The prospect of the program improves by dividing.
Because it becomes easy to recycle and to develop the large number of people.
Problem

It returns to contents.


< - Advanced -> to the returning following. the first  that returns