※スタイルシート未対応ブラウザではレイアウトを正確に再現できません。
  > | 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 11   

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


[1] Basic knowledge


[  1-1  ]
What is called the declaration of the shape of the function at the head of the program?

[  1-2  ]
What is called the variable declared to pass the function the numerical value?

[  1-3  ]
What are called the numerical value and the variable passed to the function?

[  1-4  ]
What is called the numerical value returned from the function?
Example solution

It returns to contents.


[2] Program readout


[  2-1  ]
In the following program, for what is function tri function?
Judging from the content of processing and the variable identifier, answer.
 
#include <stdio.h> 

int tri(int,int);  

int main(void)  
{
	int side,high,square;  

	scanf("%d,%d",&side,&high);  
	printf("%d\n",tri(side,high));  

	return 0;  
}

int tri(int side,int high)  
{
	return side * high / 2;
}
Example solution

It returns to contents.


Memo


[  3-1  ]
The Olympics must be held when you input the age at the Christian era or make the displayed program.
However, make the part where holding the Olympics is calculated as another function.
- 2000Age..summer..rally..open..afterwards..winter..summer..winter..summer..order..open..do.
  Moreover, this schedule is assumed not to go mad through all eternity.
Example solution

It returns to contents.


[4] Description type


[  4-1  ]
Explain the function is made concisely probably because of ..what...
Example solution

It returns to contents.


[5] Basic knowledge(example solution)


[  1-1  ]
Prototype declaration

[  1-2  ]
Dummy argument

[  1-3  ]
Actual argument

[  1-4  ]
Return value
Problem

It returns to contents.


[6] Program readout(example solution)


[  2-1  ]
Function that calculates area of a triangle
Problem

It returns to contents.


Memo(example solution)


[  3-1  ]
 
#include <stdio.h> 

int olympic(int year);  

int main(void)  
{
	int year,hold;  

	scanf("%d",&year);  
	hold = olympic(year);  
	
	switch (hold) { case 0: 
		Printf ("\n not opened");  
		break;  
	case 1:  
		Printf ("Olympic Summer Games \n");  
		break;  
	case 2:  
		Printf ("Olympic Winter Games \n");  
		break;  
	};

	return 0;  
}

int olympic(int year)  
{
	if (year % 2 == 0) { if (year % 4 == 0) { return 1; 
		} else { 
			return 2;  
		}
	} else { 
		return 0;
	}

}
- oThe return value of the lympic function is associated with holding.
- Attention of forgetting prototype declaration easily.
Problem

It returns to contents.


[8] Description type(example solution)


[  4-1  ]
The entire program is completed by making the function according to the function, and combining it.
Because it becomes easy to make, even a big program :.
Problem

It returns to contents.


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