- ..clause 1..: Basic knowledge
- ..clause 2..: Program readout
- Memo
- ..clause 4..: Description type
- ..clause 5..: Basic knowledge(example solution)
- ..clause 6..: Program readout(example solution)
- Memo(example solution)
- ..clause 8..: Description type(example solution)
[ 1-1 ]
What is called the variable to which the value is not changed while programming it?
Example solution
[ 1-2 ]
What is called the simple function made by using the replacement function?
Example solution
[ 2-1 ]
In the following program, for what is macro TRI macro?
Judging from the content of processing and the variable identifier, answer.
#include <stdio.h> #define TRI(A,H) ((A) * (H) / 2) int main(void) { int side,high,square; scanf("%d,%d",&side,&high); printf("%d\n",TRI(side,high)); return 0; }
Example solution
[ 3-1 ]
It made it by exercise 11.
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. 」
Return it by the enum constant of the return value of the function in addition based on the problem.
Example solution
[ 4-1 ]
The numerical value is written directly or though the variable only has to be used
Explain the reason in the use of the constant purposely indirectly why.
[ 1-1 ]
Constant
Problem
[ 1-2 ]
Macro
Problem
[ 2-1 ]
Macro from which area of three corner type is requested.
Problem
[ 3-1 ]
- I think that I can actually feel that it is more comprehensible than it distinguishes by the numerical value.#include <stdio.h> int olympic(int year); enum { OLYMIPC_NON, OLYMIPC_ SUMMER, OLYMIPC_WINTER, }; int main(void) { int year,hold; scanf("%d",&year); hold = olympic(year); switch (hold) { case OLYMIPC_NON: Printf ("\n not opened"); break; case OLYMIPC_SUMMER: Printf ("Olympic Summer Games \n"); break; case OLYMIPC_WINTER: Printf ("Olympic Winter Games \n"); break; }; return 0; } int olympic(int year) { if (year % 2 == 0) { if (year % 4 == 0) { return OLYMIPC_SUMMER; } else { return OLYMIPC_WINTER; } } else { return OLYMIPC_NON; } }
Problem
[ 4-1 ]
It becomes comprehensible because the name is named, and the change is prepared, too.
In addition, never change the value by mistake because the constant cannot be substituted.