In-process output
Write yourself a _itoa conversion
void Main ()
{
int num = 0;
scanf ("%d", &num);
printf ("num=%i", num); %d,%i the same effect
Char str[32] = {0};
_itoa (num, str, 2); String, first integer, str string, 2
printf ("\n%s", str);
System ("pause");
}
<1.txt is equivalent to using 1.txt to enter
>2.txt is equivalent to using 2.txt to output
Operands, operators, and expressions
operator cannot be adjacent, +-sometimes as positive negative
Multiplication sign can not be omitted
#include <stdio.h>
#include <stdlib.h>
void Main ()
{
printf ("%d", 1 + 3);
printf ("\n%d", (int) (3.5 * 2));
GetChar ();
}
Only integers can be modeled
Use of the mold:
#include <stdio.h>
#include <stdlib.h>
void Main ()
{
int num = 95;
int g = num% 10;
int s = NUM/10;
printf ("%d", G * + s);
GetChar ();
}
Assignment operators
A variable with a memory entity can be assigned a value
Values that are assigned are called Lvalue values
Values that can be assigned to other variables on the right side of the assignment number are called rvalue values.
The left value must be the right value.
+ = can not have spaces in the middle
Expression binding direction: from right to left
Assignment automatically completes data type conversions
The value on the right is converted to the data type on the left
such as: int a=10.998;
A value of 10 is printed
Self-increment auto-decrement operator
num++ First Call, then self-increment
++num first self-increment, then call
void Main () {
int num=10;
printf ("%d", num++);
printf ("\n%d", num);
GetChar ();
}
Print out the results:
10
11
void Main () {
int num=10;
printf ("%d", ++num);
printf ("\n%d", num);
GetChar ();
}
Print out the results:
11
11
+ + can only be used for variables, 5++ is the wrong wording, the value in the register cannot be + +
+ + priority over subtraction
Learn from Yin Cheng and C + + 007