Learn from Yin Cheng and C + + 007

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.