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


  Exercise 16   

  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 called the method of bringing two or more different types together?
Example solution

It returns to contents.


Memo


[  2-1  ]
Make the program that inputs the name, the age, and sex of three and displays it.
However, data is assumed to be a memory with the structure.
Moreover, the data input and the display are assumed to do making a function respectively special.
Example solution

It returns to contents.


[3] Description type


[  3-1  ]
To memorize data without trouble even if it declares a variable separately
Explain the structure is purposely used concisely why.
Example solution

It returns to contents.


[4] Basic knowledge(example solution)


[  1-1  ]
Structure
Problem

It returns to contents.


Memo(example solution)


[  2-1  ]
 
#include <stdio.h> #include <string.h> 

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

void InputPeople(People *data);  
void ShowPeople(People data);  

int main(void)  
{
	People data[3];  
	int i;  
	
	for (i = 0;i < 3;i++) { 
		InputPeople(&data[i]); 
	}
	
	for (i = 0;i < 3;i++) { 
		ShowPeople(data[i]); 
	}
	
	return 0;  
}

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");
}
- If you greatly enhance this program
  It is also possible to make an easy directory management program.
Problem

It returns to contents.


[6] Description type(example solution)


[  3-1  ]
Because it is possible to manage bringing data with relativity together if it makes it to the structure and it is convenient.
Problem

It returns to contents.


< - It is advanced -> | in | head that returns  to returning  next |.