- ..clause 1..: Basic knowledge
- Memo
- ..clause 3..: Description type
- ..clause 4..: Basic knowledge(example solution)
- Memo(example solution)
- ..clause 6..: Description type(example solution)
Example solution
[ 1-1 ]
What is called the method of bringing two or more different types together?
Example solution
[ 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
[ 3-1 ]
To memorize data without trouble even if it declares a variable separately
Explain the structure is purposely used concisely why.
Problem
[ 1-1 ]
Structure
Problem
[ 2-1 ]
- If you greatly enhance this program#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"); }
It is also possible to make an easy directory management program.
Problem
[ 3-1 ]
Because it is possible to manage bringing data with relativity together if it makes it to the structure and it is convenient.