Getting started with iOS development☞C language (char type, case), ioschar

Source: Internet
Author: User

Getting started with iOS development☞C language (char type, case), ioschar
Char type

Encoding scheme

ASCII: 'A' = 65 'A' = 97 '0' = 48

GB2312: 2Bytes corresponds to a Chinese character

Tao Zhu Xiaoji (this encoding does not contain the word "yellow" or "yellow)

GBK: 2Bytes corresponds to a Chinese character

GB18030: UTF-8: Variable Length, 1 Bytes, 2 Bytes, 3 Bytes, 4 Bytes

Special characters

\ N newline \ B backspace character \ r carriage return \ Escape Character \ t Tab

 

Case

  

  

  

  

  

  

  

  

  

  

  

  

 

/** Print the nine cells */

 

# Include <stdio. h>

# Include <assert. h>

Int main (){

Printf ("enter an odd number :");

Int n;

Scanf ("% d", & n );

// Asserted to determine whether a condition is true. If not, the program exits.

Assert (n % 2! = 0 );

Int nine [n] [n]; // Save the array of the nine Cells

For (int I = 0; I <n; I ++ ){

For (int j = 0; j <n; j ++ ){

Nine [I] [j] = 0;

}

}

// Place I in the place of the loop

Int row = 0; // The row. The first row is the top row.

Int col = n/2; // column, initially the middle column

For (int I = 1; I <= n * n; I ++ ){

Nine [row] [col] = I;

// Calculate the row and column to be placed in the next number

// Go up at 45 degrees

Row --;

Col ++;

// If they all cross the border, put them below the original

If (row <0 & col = n ){

Row + = 2;

Col --;

}

// If the row is out of bounds, put it at the bottom

Else if (row <0 ){

Row = n-1;

}

// If the column is out of bounds, place it on the leftmost side.

Else if (col = n ){

Col = 0;

}

// If the conflict exists, put the following:

Else if (nine [row] [col]! = 0 ){

Row + = 2;

Col --;

}

}

// Print

For (int I = 0; I <n; I ++ ){

For (int j = 0; j <n; j ++ ){

Printf ("% d", nine [I] [j]);

}

Printf ("\ n ");

}

Return 0;

}

 

 

Related Article

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.