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

Source: Internet
Author: User

I. PTA Lab Assignment Topic 1: Array loop Left (1). PTA Submission List

(2). Design ideas

Define integer variable n,i,m;
Input n
Defines the array a "n", B "n";
Input m
for 1 to N-1
Input array a "n"
If n>m{
Seventh step: for 0 to N-m-1
B[I]=A[I-N+M]
For 0 to N-1
If i<n-1
Output B "I" + Space
Otherwise output B "i"}
Otherwise m=m-n until n<=m.
Repeat the seventh step.

(3). Code

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

Think too simple, did not think that the number of moves may be greater than the length of the array, after the PTA prompted to modify, the problem is not enough to resolve

Topic 2: Find the saddle point (1). PTA Submission List

(2). Design ideas

Define variable i,j,k,g,n,flag=1,count=0;
Enter N;
Defining a two-dimensional array a[n][n]
For 0 to N-1 I
For 0 to N-1 J
Input array A "I" "J"
For 0 to N-1 I
For 0 to N-1 J
For 0 to N-1 K
If a "I" "J" <a[i][k]
Flag=0, jump out of the loop
otherwise flag=1
If flag==1{
For 0 to N-1 G
If a "I" "J" >a[g][j]
Flag=0, jump out of the loop;
otherwise flag=1
Otherwise, jump out of this cycle into the next loop
If flag=1, output I j,count=1;
If count=0, the output is none;

(3). Code
![](https://images2018.cnblogs.com/blog/1240473/201712/1240473-20171203195149913-664454251.png)
(4). Problems encountered in debugging process and PTA Submission List situation description

Forget the use of the continue statement, resulting in not satisfied with the maximum number of rows do not know how to handle, can not jump out of the loop and do not know how to jump out of this cycle

Topic 3: Addition Table of formulas (1). PTA Submission List

(2). Design ideas

Defining integer Variables A,i,j,repeat,n
Input repeat
For 1 to repeat a
Input n
Defines the array a "n+1" "n+1"
For 0 to N i
for 0 to N J
A[i][j]=i+j;
For 0 to N i
for 0 to N J
If I is 0
If a "I" "J" is 0
Output +, jump out of this cycle into the next loop
If j==0
Output a "I" "J"
Otherwise output a "I" "J" aligns to the right four characters, jumping out of this cycle into the next loop
If I>=j
If i=j, output a "I" "J"
Otherwise output a "I" "J" aligns to the right four characters
Line wrapping at end of each loop

(3). Code

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

The array size is defined only by the n given by the topic, but the actual operation finds that the array cannot hold so much data

Second, this week's topic set PTA Final ranking three, peer code peer peer review

1. Mutual evaluation students name: Zheng Wei

2. My Code, mutual evaluation of the student code

My Code

Classmate's Code

3. Where do I differ from my classmates ' code? What are the advantages? What style of code do you prefer?
My code is to solve the problem with two arrays, an array of the number of occurrences of an array of numbers, while the classmate of the code an array of double loops can resolve the issue. Two of our shortcomings are not annotated, see his program is very tired, he looked at me also very hard

Iv. Study Summary of the Week 1. What did you learn?

1. What have you learned?
How do I store strings in 1.1 C?
Defining character array storage strings

1.2 What is the end flag of a string and why do you want to end the flag?
'% ' determines whether a string ends as a condition for the end of a loop

1.3 What are the methods for string input?
Gets (a)
Scan ("%s", &a)
for (i=0;a[i];i++)
scanf ("%c", &a[i]);

1.4 Numeric characters How to turn an integer, write a pseudo-code?
Define the character type variable ch;
Define the shaping variable N;
Input character number Ch
Convert with ASCII code n = ch-48 (48 is number 0)
Output integer number n

1.5 16 binary, binary string how do I turn 10 binary? Write pseudo-code?
16 binary:
Defining a character array a[80]
Define integer variable N
Nr=0
I for 0 to a[i] not equal to
If A[i] is a character 0 to 9,nt=n16+a[i]-' 0 ';
If A[i] is ' a ' to ' f ', n=n16+a[i]-' a ' +10;
If A[i] is ' a ' to ' F ', n=n16+a[i]-' a ' +10;

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

The definition of how strings are entered is not clear enough.
The error point for the segment error is still not clear.

3. Midterm summary

3.1 Why do you think you didn't do well?
For time allocation, the bigger picture of the exam is not in control.
Problem solving is too urgent, causing the program to write and modify the repeated
Scaled's not good enough.

3.2 List the wrong questions.
Single choice 3; 4;6;11;16;18
Analysis procedure 1; 2; 3

3.3 The second half semester how to adjust C's study?
Still have to lay a good foundation, and then solve the programming problem can not be the knowledge points fall
The ability to read a program also improves

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.