ASP. NET Learning Note 1

Source: Internet
Author: User

Grammar rules


To define a variable specification:

Variable definition: Use front + underline + literal words to avoid conflicts with C # keywords

int I_age

Double D_weight

Double D_height


Local variables

int _age

Double _weight

Double _height


Integers into strings

_age. ToString ()


String variable integer

String str_a = "", Str_b = "30";

int i_a, I_b;

I_a = Convert. ToInt16 (str_a)

(I_a + i_b). ToString ();


Integer variable character

Char chr_a;

Chr_a = Convert.tochar (65)


Line break <br/>


C # Data types

String Str_result;

Str_result = Str_name + "This year" + S_age. ToString () + "old <br/>" +

"is more than 30 years old:" + b_outageline;

int 32 bit

Short 16 bit

Double value: 15-16 digits after the decimal point

Float single-precision floating-point f_weight = 67.5f

Boolean b_outageline Ture or False

B_outageline = s_age > 30;

DateTime Dt_birthday;

Dt_birthday = Convert.todatetime ("1901-1-2");


Loop statement:

int i_start = 65;

for (int i=0; i < 6; i++) {

Chr_a = Convert. ToChar (I_start);

Response.Write (chr_a + "<br/>");

I_start + +;

}


Array:

Declares an array int[] A;

Create an array of 5 elements

A = new Int[5]

int [] A = new int[5]


The + assignment can be defined directly: int [] b = new int [] {1,2,3,4,5,6,7} subscript is 0-6


double [] da_a;

da_a = new Double [4] {56.34,55.33}


string [] stra_a = new string [4]


Assignment Operators :

a+= b; equivalent to A=a+b;

a%=5; A= a%5; Take the remainder

x=a++ + b+c; Equivalent to: x=a+b+c; a=a+1;

X=++a + B + C; Equivalent to: a=a+1; X= A+b+c;

A-=b;

A*=b;

A/=b;


number of daffodils : the sum of 3 powers of three digits of a number equals itself

int I_unit, I_ten,i_cen

for (int i = +; i<999; i++)

{i_unit = i% 10;

I_ten = (I/10)%10;

I_cen = i/100;

if (Math. Pow (i_unit,3) + Math.pow (i_ten,3) + Math.pow (i_cen,3) = i)

{

Str_result + = i + ",";

I_count + +;

}

}


Continue jump out of this loop and perform the Next loop



650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M01/8C/85/wKioL1hvJejC9J9cAAHs9_nmWDE156.png-wh_500x0-wm_ 3-wmp_4-s_1326820930.png "title=" CSharp keyword. png "alt=" wkiol1hvjejc9j9caahs9_nmwde156.png-wh_50 "/>

ASP. NET Learning Note 1

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.