I'm from Lan Yi education.
The next day I learned the simple calculator subtraction, variables, bool variables, and if judgments. Better grasp of the situation.
First I learned a simple calculator. In the interface, enter two Uitextview to add numeric values, and four buttons below represent subtraction, then two labels for symbol display and calculation results. The graph is like this:
———————— The global variables that are subsequently learned ————————
The difference between a global variable and a local variable:
Global variables are variables that are valid throughout the source program, and local variables die after the end of the function or loop to which they belong. The entire program uses variables to define global variables, and if it is a function, define local variables so that other functions can redefine variables with the same name. If you use global variables, when you encounter a large program, the program is composed of different people to separate their own modules or functions, can not avoid the definition of the same name variable, will conflict.
BOOL Variable: BOOL is a Boolean variable, which is the definition of a logical variable, similar to float,double, except that float is defined as a floating-point type, and a double-precision floating-point type is defined.
———————— If Judgment ——————————
1. The first form is the basic form: if
An if (expression) statement
For example:
Ain () {
? int A,b,max;
printf ("\ n input, Numbers:");
scanf ("%d%d", &a,&b);
Max=a;
if (max
printf ("max=%d", Max);
}
2. The second form is: If-else
if (an expression)
Statement 1;
Else
3. The third form is if-else-if form
The first two forms of the IF statement are generally used for two branches of the case. When there are multiple branch selections, the IF-ELSE-IF statement can be used in the general form:
if (expression 1)
Statement 1;
else if (expression 2)
Statement 2;
else if (expression 3)
Statement 3;
...
Lan Yi IOS Learning Note scope If judging bool variable