C # language and variables, data types

Source: Internet
Author: User

1. Use of code computer language: C, PHP, Ruby, Java, C #, Basic, JS, C + + Source code: is the content written in a computer language compiling: Converting source code into machine code with compiler Machine Language: Machine language is a language that can be understood and executed directly by the computer 2.c# Statement Output output text to the current location of the console: console.write ("text content"); output text at cursor position Console.WriteLine ("Text content"), output text at the cursor position, and then wrap 3. Data type: Classification and generalization of data
Char Character type
String literal type
int integer type
Double Decimal type 4. Variables: declaration of variable: data type variable name; Assignment of variables: variable name = data; 5. Naming conventions for variables Hard requirements: ① The rules that must be followed ② variable names can only be made up of numbers, letters, underscores ③ variable names must not start with a number
The ④ name cannot be the same as a keyword (with a special-purpose word)
⑤ variable names must not be the same in the same function
Soft Requirements: ① recommended rules to follow ② variable name to be able to look at the text to know the meaning
③ variable name first letter lowercase
④ In addition to the first word, capitalize the first letter of the other word
6. The writing format of the variable Write separately: data type variable name;
variable name = variable value;
Merge writing: data type variable name = variable value; 7. Type conversion numeric types with a small range of values → A numeric type with a large range of values "implicit conversions: no extra code required, computer auto-complete conversion"
numeric types with large range of values → numeric types with a small range of values "explicit conversions (casts): Additional code needs to be written and the computer does not automatically convert"
Explicit conversions (casts) can cause data loss 8. Data operations: Plus (+), minus (-), multiply (*), except (/), redundancy (%) int type and int type for operation, return type int type
Double type and double type for operation, return type double type
int type and double type for operation, return type double type
9. Data type: For real numbers with high computational accuracy requirements, use decimal

C # language and variables, data types

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.