C Language Sixth week blog job-data type

Source: Internet
Author: User
Tags array length rows count

I. PTA Lab Assignment Topic 1:7-6 fall into the number of traps 1. PTA Submission List

2. Design ideas define Variable n,i,g=1/ Number of digits/,a/ the sum of the numbers/,b=0,j,n1,c,d/ Store N/;

do{
for (i=0;i

3. Code

4. Problems encountered during commissioning and solutions

Topic 2:7-4 print diamond pattern 1. PTA Submission List

2. Design ideas int n,a,i,l,j,k,g,h,count=0,count1=0;

Input n
if ((n-1)%2==0) continues
As can be seen from the law,
Upper half (large triangular type) with (n+1)/2 rows
For (i= (n+1)/2;i>0;i--) {
Number of rows count plus 1
number of inputs =2count-1
For (j=2count-1;j>0;j--)
output line break after entering each line

For (k= (n-1)/2;k>0;k--) {
The lower half has (n-1)/2 rows
Ibid.

3. Code

4. Problems encountered during commissioning and solutions
    • 1. Idea error: The step of missing the space
    • . Solution: As above code. Output spaces according to the law of the number of spaces and the number of rows
    • 2. Partially correct: if ((n-1)%2==0) When judging odd numbers, the remainder is written as division
      .
    • Solution: Change to% of redundancy
Topic 3:7-9 Split expression 1. PTA Submission List

2. Design Ideas 3. Code

4. Problems encountered during commissioning and solutions
    • 1. Compile error: Because of the initial character array, it is written as a GetChar
Two. PTA Submission List and final rankings for this week's topic set

Iii. Summary of the study this week (3 points) 1. What have you learned?
    • 1.1 How is a one-dimensional array defined and initialized?
      Type an array group name [array length];
      such as: int a[10];

    • 1.2 A one-dimensional array in-memory structure? can draw a description. What does an array name mean?

The structure of one-dimensional array in memory is continuous and linear;

Array name specifies the type of each element within the array

    • 1.3 Why use arrays?
      Using an array allows a group of variables of the same type to use the same array variable name, using subscripts to differentiate each other
      Simple expression, good readability, easy to use loop structure

    • 1.4 Introduction to the selection method, bubble method, direct insertion sort how to sort? Pseudo code display.
      Bubbling method
      Bubble sorting: 22 compares the keywords of the records to be sorted, and finds that the two records are exchanged in reverse order until there are no reversed records.

    • 1.5 What is the binary search method? It differs from the order lookup method?

Binary search method is to find the middle position of the array number, determine whether it is to look for the number, not the words, greater than the number to find, then left to continue two points, less than the number to find, then to the right two points.
The binary lookup method is applied to the sorted array, the speed is fast, and the sequential lookup method is used to repeat the group, which is inefficient when the array is large, but is not required by the arrays themselves, and is suitable for short arrays

    • 1.6 How are two-dimensional arrays defined and initialized?
      The two-dimensional array defines the format as type an array group name [length of the line] [column]
      The initialization format is type an array group name [length of line] [column lengths] = {{Initial value table 0}, ..., {Initial value table K}, ...} If all rows are initialized, the row length can be ignored

    • 1.7 How is the matrix transpose implemented? In the matrix: the relationship between the row label I of the lower triangle, the upper triangle and the symmetric matrix J? Please state.

Qi>=j triangle i<=j symmetric matrix A[i][j]=a[j][i]

    • 1.8 What is the general application of a two-dimensional array?
      When the number in the array represents more than one meaning, such as when we want to represent different people's scores for different subjects, there are two variables, different people and different subjects, so to use two-dimensional matrices, or matrices, we need to use two-dimensional arrays
2. This week's content, you are not what?
    • 1. For the two-dimensional matrix is not proficient. Especially transpose

C Language Sixth week blog job-data type

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.