C Language Blog Job--one or two-dimensional array

Source: Internet
Author: User

First, the PTA laboratory work Title 1:7-1 the number of arrays in reverse order to store 1. PTA Submission List

2. Design Ideas
  • 1. Define a array to hold values, define B arrays for reverse order, define variables N,i,j
  • 2.for (i=0;i<=n-1;i++) Enter a value in the A array
  • 3.for (j=0;j<=n-2;j++) places a in reverse order into B
  • 4. Output B Array

    3. Code

    4. Problems encountered in debugging process and PTA Submission List situation description.


    Format error: The last one with no spaces is correct: at the very beginning I had a wrong output range and a number was missing.

    Topic 2:7-4 simplified insertion sort 1. PTA Submission List

    2. Design Ideas

  • 1. Define the array A, define the variable n,x,y,c as the judging variable
  • 2. Store the number in a
  • 3. If n is 0, direct output x
  • 4.N not 0, enter loop from right to start with X once, when X<a[j] a[j+1]=a[j], that is, to move the previous element to the right
  • 5. Otherwise a[j+1]=x and make Y=1
  • 6.y=0, that is, X is smaller than the minimum value of the sequence, a[0]=x;
  • 7. Define variable C output A[C]

    3. Code

    4. Problems encountered in debugging process and PTA Submission List situation description.


    There is no direct output of n 0 o'clock, and no X-min output.

    Topic 3:7-7 Find Saddle point 1. PTA Submission List

    2. Design Ideas

  • 1. Define the variable n, define a two-dimensional array a[80][80],
  • 2. Store the number in a two-dimensional array a
  • 3. When the array has only one element, direct output 0 0
  • 4. Otherwise, define Max, and a one-dimensional array B,
  • 5. Use the loop to find the maximum number of each row and store it in B
  • 6. Define min, and a one-dimensional array C,
  • 7. Use the loop to find the smallest number of each column and store it in C
  • 8. Define the variable t for judging, compare the corresponding elements in the B and C arrays, and if equal, output subscript and t=1
  • 9. Otherwise, if the t=0 output is None

    3. Code


    4. Problems encountered in debugging process and PTA Submission List situation description.

    The initial answer is wrong, because the situation in the loop is not "=" so that there is less than a number, and then because there is no judgment n=1 case, no output 0 0

    Second, this week's topic set PTA Final ranking.

    Third, peer code peer review 1. Mutual evaluation of students name: Lu Yong 2. My Code, mutual evaluation of the student code


    3. Where do I differ from my classmates ' code? What are the advantages? What style of code do you prefer? If the classmate code is wrong, please help to point out where the problem.

    He uses nested loops to compare and output directly within the loop, while mine is using a loop to make a branch judgment within the loop, his code is simple but not too easy to understand, my long but easy to read, more like easy to understand style.

    Iv. Study Summary of the Week 1. What did you learn? How do I store strings in 1.1 C?

    Strings can be placed in a one-dimensional character array, and string constants can also be used

    1.2 What is the end flag of a string and why do you want to end the flag?

    End flag is, use end flag to control loop end

    1.3 What are the methods for string input?

    Assignment method, cyclic input

    1.4 Numeric characters How to turn an integer, write a pseudo-code?
  • 1. Defining variables I,numberstr[10]
  • 2. Enter a string,
  • 3. Using loops, number=number*10+str[i]-' 0 ' to convert separately
  • 4. Output integer

    1.5 16 binary, binary string how do I turn 10 binary? Write pseudo-code?
  • 1. Define the variable number put string with a to store
  • 2. If the character 0<a<9,number=number16+a[i]-' 0 '
  • 3. If the character a<a<z,number=number16+a[i]-' a ' +10
  • 4. If the character a<a<z,number=number*16+a[i]-' a ' +10
  • 5. Output number

    2. This week's content, you are not what?

    Encounters the input and output of the space carriage return, the two-dimensional array is not familiar, the subscript of the two-dimensional array is sometimes chaotic, and several sort methods do not

    3. Midterm Summary 3.1 Why do you think you didn't do well?

    Poor foundation, weak ability, no knowledge of some basic concepts, poor ability to read programs

    3.2 List the wrong questions.




    3.3 The second half semester how to adjust C's study?

    First of all to have patience, and secondly to have a correct attitude, C is not just programming there are some basic knowledge points to remember, can not pay attention to the basic knowledge of textbooks, otherwise, like this exam, choose the wrong pile, in addition, in the normal programming time also should pay attention to the accumulation of errors and personal often make mistakes in correcting.

C Language Blog Job--one or two-dimensional array

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.