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

Source: Internet
Author: User

First, the PTA experimental work Title 1:7-2 to find the number of integers in the sequence of the most occurrences of 1. PTA Submission List

2. Design Ideas
    • Define the variable N,i,j,max equal to 0,a[]10 used to hold the input value, b[10] to hold the number of individual numbers in a[];
    • Enter the value of n
    • I start at 0, add 1 each time, enter the value of A[i] until the i==n ends the loop
    • I starting from 0, judge whether I <n,, go to the next step, add one at a time, until the condition is not satisfied
      J Starting from 0, judge whether J <n,, go to the next step, add one at a time, until the condition is not satisfied
      If A[i]==a[j],b[i] plus a
    • I starting from 0, judging whether I
    • Output A[J] and Max values
3. Code

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


At that time due to create a new array c[] to store b[] cause the subject of too many variables, in some parts of the wrong, with Dev debugging, too many variables, it is difficult to see clearly, then will c[] Delete, with b[] to do the right.

Topic 2:7-8 addition tables 1. PTA Submission List

2. Design Ideas
    • Define variable Repeat,i,n;
    • Enter a value for repeat
    • J starting from 1, to determine whether J <n+1,,a[o][j] add one at a time, until the condition is not satisfied
    • Call function void Arrange (int n);
    • Define variable a[][],i,j,op= ' + '
    • J Starting from 0, add 1,a[0][j]=0 each time, until i==n+1 end cycle
    • I starting from 1, judge whether I <n+1,, go to the next step, add one at a time, until the condition is not satisfied
      J Starting from 0, judge whether J <n+1,, go to the next step, add one at a time, until the condition is not satisfied
      A[i][j] equals j+i
    • The value of the output op
      J starting from 0, output A[0][J] go to the next step, add one at a time, until the condition is not satisfied
      Line break
      Starting from 1, determine whether I <n+1,, go to the next step, add one at a time, until the condition is not satisfied
      J Starting from 0, judge whether J <n+1,, go to the next step, add one at a time, until the condition is not satisfied
      Output A[I][J] Value and wrap
3. Code

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


The subject requires that the last value of each line is not followed by a blank line, and four columns, I used a space, and then changed to 3 spaces, only to understand that four columns are 3 spaces.

The topic 3:7-9 judges the upper triangular matrix 1. PTA Submission List

2. Design Ideas
    • Define variable t,n,i,j,k,a[][]
    • Enter the value of T
    • I start at 0, add 1 each time, enter the value of n until the i==repeat end loop
      J Starting from 0, add 1 each time, go to the next step until the i==nt end loop
      I start at 0, add 1 each time, enter the value of A[i] until the i==n ends the loop
      Enter the value of A[i][j]
    • Call function S=arrange (a,n);
    • If S=1, the output is yes, otherwise the output no
    • Defining Variables Ijs
    • I start from 0, add 1 each time, enter until the i==n end cycle
      J Starting from 0, add 1 each time, go to the next step until the i==nt end loop
      If A[I][J] is not equal to 0,s=0, jump out of this loop
    • return s
3. Code

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



At first, I thought it was the following part of the error, from the bottom to the next comment off, and later found that it is scanf added a newline symbol error.

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

Third, peer-to-peer evaluation of code pairs

Jie Wei's code

My Code

    • 1. I am different from his code is the summation of the addition of the a[i][j]=j+i I find the law to seek; He is using a[k][m]=a[0][k]+a[m][0]; His method is more adaptable.
    • 2 for output I use a space relative to him more concise, less code, with -4d considerations too many factors, more error-prone
Iv. Study Summary of the Week 1. What did you learn?
    • I learned to use Rand to make computers "themselves" produce numbers.
    • I learned to use gets (), enter
How do I store strings in 1 c?
    • 2. Use character array to save;
    • 2. Storing strings using character pointers
1.2 What is the end flag of a string and why do you want to end the flag?
    • ' 0 '
    • Make string End Normal
1.3 What are the methods for string input?
    • scanf ("%s", a);
    • scanf ("%c", p);
    • Gets (a);
1.4 Numeric characters How to turn an integer, write a pseudo-code?
    • Define an integer variable i, and a character-shaped variable J
    • I equals J-character 0+0
1.5 16 binary, binary string how do I turn 10 binary? Write pseudo-code?

16 binary into 10 binary

    • Define a variable number of 0, array a[]
    • Enter a 16-binary string into a[i]
    • I start from 0, add 1 each time, proceed to the next step until the a[i]==0 end loop
      If A[i] is between 0 and 9, Number=number16+a[i]
      If A[i] is between A and F, number=number
      16+a[i]-' a ' +a
      If A[i] is between A and F, number=number*16+a[i]-' a ' +a
    • Output number

Binary turns into 10 binary

    • Define a variable number of 0, array a[]
    • Enter a 12-binary string into a[i]
    • I start from 0, add 1 each time, proceed to the next step until the a[i]==0 end loop
      Number=number*2+a[i]
    • Output number
2. This week's content, you are not what?
    • There's no point in thinking about the subject.

* For this topic does not understand the test instructions, causes the class assignment this question completely does not fill

    • For Get (a), scanf ("%s", a) uses a less familiar
3. Midterm summary 33.1 Why do you think you didn't do well?
    • First of all, I'm not very familiar with the conversion of 10 binary 2 binary 16 binary.
    • For bitwise operations in expressions, equal-sign expressions, comma-expressions, and logical expressions do not
    • Write code to write the difference, no comments, looks very ugly

      33.2 List the wrong questions.

      For example, the 4th problem of a single-choice exam,

    • Bytes: 8 bits constitute 1 "bytes", which is the basic unit of measurement for storage space.
    • The Pentium machine is widely used at present, its word length is 32
    • Because each byte is 8 bits
      This problem is wrong to understand the concept of byte
      Like a blank question.

    • Total = 10
      I'm wrong about the problem with no spaces.

Like changing the wrong question.

    • n++ changed to n=n+2 not changed.
      Because the algorithm for this problem is not clear, so wrong

Like programming questions.

    • is for the x=[+ of the two-time equation-(b^2-4ac) ^ (-B]/2A) This will not lead to x1,x2 no way to write the code, add the formula is correct

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

    • I think I should do a good job in the preview, correct my attitude to the class school is not serious.
    • In doing PTA should spend more time, should not in a question on the time of the day, improve efficiency.
    • After the teacher finishes, should review oneself does not understand the place, solves it, in the blog homework summarizes own one weeks to learn with not the content.

C Language Blog Job-one or two-dimensional array

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.