20165318 preparatory work Two basic research on learning basic and C language

Source: Internet
Author: User
Tags repetition stringbuffer

20165318 Learning Basics and C language Basic survey skills learning experience

Our generation, more or less have all kinds of interest classes, dance piano painting calligraphy, I am so. But the only thing that can be taken out of these skills is dancing. In accordance with the standard of "excellent teaching methods---Coaching and doing high school": The mastery of a skill is divided into: Novice/Advanced Beginner/qualified/proficient/expert. I don't think I can reach the level of a qualified person, and I can't say that I'm above most people.

From 4 years old to learn 14 years old, these years of study, or bring me a lot of inspiration, to learn a skill, to have the following points:

  • Interest : Interest is the best teacher. I was very interested in dancing when I was a child, watching the dance show on TV, always follow the music to jump up, at the age of 4 took part in the dance class, the system of learning. With the process of learning, I have more in-depth experience of the charm of the national dance, the interest of its more profound, now to the university, I still do not lose interest in dance, joined the school dance team, in the anniversary of the stage to show elegant demeanor.
    Perseverance : do not just look at the clock, to emulate the clock, always go forward. "10,000 steps a day, minus 10 pounds a week," said: "Limit you to complete 10,000 steps a day what is the barrier?" Are you sick? Have you met a typhoon? Is it raining hard? Fog and haze? In fact, what is not, is your perseverance and determination. Like the days when I practiced dancing, whether it was raining or snowing, I was never late. Since the age of 9, because of the lack of teachers in the county, my mother will take me to the city every weekend dance lessons, rain or shine. Practice Dance The most important is the basic skills, and the basic training is always painful, each pull waist, shoulder is very painful, in this period, I have had the idea of retreat, but eventually all bite teeth insisted on down, until third day had to give up.
  • Deliberate training : "Do high school (learning by Doing)" Table tennis Deliberate training one year summary of the article said: "Take the" comfort zone, only in the "Learning area" study, pay attention to gradual progress, can not enter the "panic zone." For example, basic training, in doing the action can not rely on their own feelings, how comfortable how to come, and to remember the essentials of action, in training, according to the essentials to do the action. The basic training is the repetition of every lesson, thus having muscle memory . Folk dance is the most moving place is the charm, rhyme practice is also the basic part of national dance, after a long period of deliberate practice, dance action will have its unique charm.

    The routine (Kata) pointer exercises a repetition of a particular technique or skill, thus mastering it. This concept is borrowed from martial arts and refers to a series of actions and moves that can be practiced alone or by many people.
    Sports Beginners Practice all need to repeat the action, such as "Learning to play table tennis" to practice swing, swing after thousands of times after the action will be stereotypes, that is, the coach often said "muscle has memory ability", after the actual combat can be done without hesitation.
    --Quoting from "excellent teaching methods---Coaching and doing high school"

  • Timely feedback : Dance action has a lot of essentials, do not standard sometimes affect the overall effect, in my learning process, my teacher can always correct my mistakes, so that I get timely feedback, and then gradually, to achieve higher levels.

    I think the same is true of Java learning:
  • To develop interest in Java
  • Have the determination to learn Java and stick to it
  • Practice on a daily basis, master basic skills and enter the learning area
  • Summarize your questions on the fly and give feedback to your teachers or classmates.

C Language Basic Survey How do you learn C language? (Homework, experiment, textbook, others), what are the experiences and lessons of C language learning compared to your superb skills?

I study C language is mainly in class listening, sometimes to pre-class preview and after-school practice, but due to the C language attention is not enough, usually do not adhere to daily practice, is close to the end of the time to do a lot of practice. In the C language learning process, I have been staying in the comfort zone, for a problem, only stay in can solve, without deep exploration, resulting in I just pass the exam, and not very skilled in C language. Frankly speaking, my C-language Foundation is not strong enough to explore the extent of it, this is a great lesson. Excellent teaching methods---do coaching with doing middle school mention that
To have a desire for skills, not to have the level of advanced beginners to meet, to have the dream of being an expert. If you want to do a good job, you must not be too low, and have to plan to learn.

How many lines of C code have you written so far? What is the understanding? Quantitative change caused qualitative change, how to balance the quality and quantity?

Number of code I guess I wrote about 3000 lines, basically can understand, some simple procedures can master, but difficult procedures, can only understand and basic grasp. I think, quantitative change caused qualitative change, quality and quantity is gradual, not overnight. For example, a knowledge point, not practiced once can grasp, to at least three times more deliberate practice, mastery, just calculate the basic grasp, the process, I these deliberate practice is the accumulation of quantitative changes, I master this knowledge point and can be flexible application, this is qualitative change, the gradual accumulation of quantitative changes, the final qualitative change.

Learned the C language, you divide the array pointer, pointer array, function pointer, pointer function these concepts?

An array pointer is a pointer to an array, which is essentially a pointer;
A pointer array is an array of elements made up of pointers, essentially arrays;
A function pointer is a pointer to a function, which is essentially a pointer;
A pointer function is a function that returns a value as a pointer, essentially a function.

Have you learned the C language, do you understand the differences and connections between files and streams? How do I differentiate between text files and binaries? How do I programmatically manipulate these two files?

I'm not sure about the differences and connections between files and streams, but by looking at the data, I learned that files are the basic unit of Computer Management data and an important place for applications to save and read data. A stream is an abstraction of a sequence of bytes that provides a way to write bytes to the backing store and read bytes from the backing memory. When you stream to a disk and become a file, you start a disk write operation, so that entering a character or entering a byte to start the disk operation will greatly reduce the efficiency of the transfer and affect the service life of the disk.
Text files are encoded in some characters commonly used characters, each character corresponding to the corresponding encoding, a single byte of storage space, is fixed-length, binary files are encoded in binary, can be custom-coded, is indefinite. In C, the text file operation is done through a library function, and the binaries are done by fopen,fread,fwrite three functions.

Have you learned C language, do you know what is process-oriented programming? What is the way it solves the problem?

process-oriented refers to the process as the center, through the construction process, from the top down, gradually refinement, modular solution to a problem. It solves the problem by analyzing the steps required to solve the problem, and then using the function to implement the steps step-by-time, using one-by-one calls.

What is a module in C language? Have you ever written a program for multiple source files?

The total target to be solved by the program is decomposed into several targets, then further decomposed into specific small targets, each target is called a module. I am ashamed that I have not written more than one source file program.

Have you learned the C language, do you know what is "high cohesion, low coupling"? How does this principle apply to high-quality programming?

High cohesion means that each module is made up of highly relevant code, is responsible for only one task, and is highly independent. Low coupling is: a complete system, each module is independent of each other, the interface between the module and the module, as far as possible and simple. In high-quality program design, to follow the "high cohesion, low coupling" principle, with the same function of the module as far as possible to integrate together, the different modules of nesting to be as small as possible.

Having learned C, how do you copy the contents of array A into array B? How do I find the number 5 in an integer array a? How do I sort an integer array a (small to large, from large to small)? Write the appropriate program.

Use the strcpy function to copy the contents of array A into array B:

#include <stdio.h>#include <string.h>#define N 50int main(){    char a[N],b[N];    printf("The string A is:");    gets(a);    strcpy(b,a);    printf("The string B is:");    puts(b);    return 0;}

Find the integer array A with no number 5 and sort the integer array a (small to large, from large to small)

#include <stdio.h> #include <stdlib.h>int search (int a[],int N)//find integer array A with no number 5{int i;    int flag=0;    for (i=0;i<20;i++) {if (a[i]==5) flag=1; } return flag;    void min (int a[],int n)//integer array A is sorted (small to Large) {int i,j,k,temp;        for (i=0;i<n;i++) {k=i;            for (j=i;j<n;j++) {if (A[k]>a[j]) {k=j;            }} if (K!=i) {temp=a[i];            A[I]=A[K];        A[k]=temp;    }}}void max (int a[],int n)//integer array A to sort (from large to small) {int i,j,k,temp;        for (i=0;i<n;i++) {k=i;            for (j=i;j<n;j++) {if (A[k]<a[j]) {k=j;            }} if (K!=i) {temp=a[i];            A[I]=A[K];        A[k]=temp;    }}}int Main () {int n,i,a[50];    printf ("How many numbers?\n");    scanf ("%d", &n);    printf ("Please input numbers:\n"); for (i=0;i<n;i++)    {scanf ("%d", &a[i]);    } if (Search (a,n) ==1) {printf ("5!\n in the array");    } else {printf ("There is no 5!\n in the array");    } min (a,n);    printf ("Small to large sort:");    for (i=0;i<n;i++) {printf ("%d", a[i]);    } printf ("\ n");    printf ("Sort from large to small:");    Max (a,n);    for (i=0;i<n;i++) {printf ("%d", a[i]); } return 0;}

qsort(sort an array):

void qsort ( void * base, size_t num, size_t width, int ( * comparator ) ( const void *, const void * ) );

Where base is the first address of the array, NUM is the number of elements in the array, width is the space occupied by the element, and comparator is a function pointer that needs to be defined by itself.
bsearch(Find by Array):

void *bsearch(const void *key, const void *base, size_t nmem, size_t width, int (*comp)(const void *, const void *));

Key is the keyword pointer, base is the entire array to look for, the number of elements in the Nmem array, the width of each element occupies memory, comp is a function pointer, need to define their own.
Reference: Qsort (Baidu Encyclopedia)
These two functions I have the initial understanding of the data, but also tried programming, but the final result is not debugged, it is still using the method previously learned to solve the problem.

Write a program that counts how many lines of code your C language has written.

This I did not write independently, the following is written on the basis of other people's code.

#include <stdio.h>#include <string.h>int  main(){    int    all=0;    FILE   *fp;    char   filename[100];    char   str[4096];    printf("Enter a filepath/filename:\n");    gets(filename);    fp=fopen(filename, "rt");//打开文件    if(fp==NULL)//判断文件是否正确打开    {        printf("Failure to open. \n");        exit(0);//如果错误终止程序    }    while (fgets(str,4096,fp))  //读取一行,并判断文件是否结束    {        all++;    }    fclose(fp);    printf("filename:%s 代码行数:%d",filename,all);}
Do you know what a breakpoint is? Give an example of your own debug program.

A breakpoint is the place where the program is automatically interrupted during the run, so that it does not check the debugger. When practicing the C language code, the program cannot run, often cannot find the error, this time you can set breakpoints, monitor the program to run the process, and then find where the problem occurs, and to correct. In the summary of last year's preparatory work, Lou's teacher mentioned that the debugger is not only used for debugging but also a good learning tool. This I have not explored before, I will try to learn this usage.

Chapter questions (see How to read a book quickly my questions are as follows)
  1. The first chapter mentions that a class in a Java source file can be written by itself, or it can introduce classes from a class library. My confusion is: if there is a public class in the source file, does this class have to be written by itself? If you are introducing classes from a class library, how can this class be represented?
  2. In the example of a type conversion operation, the following procedure

    float f =123456.6789f ;double d=123456789.123456789;f=(float)d;
    The result of the operation is F=1.23456792e8. My confusion is: in PPT, there is said that the float type variable storage is to take 8 valid digits, and this result has 9 valid digits. And I don't quite understand. If you assign a high-level variable to a low-level variable, how do the fractional parts trade-offs? Rounded? All of them? Full rounding?
  3. The description of the switch switch statement mentions that the "break statement is optional", but the following explains "there must be a break statement in this", and according to what we have learned before, if there is no break statement, the program will execute to the end from where the variable matches in the switch statement. So, what is the definition of "optional" in the "break statement is optional"?
  4. public class A{void f(){int m=10,sum=0;//成员变量,在整个类中有效
    M and sum in the above program are defined in the method body of F, why are they a member variable?
  5. In the fifth chapter, "Except for the object class, each class has and only one parent", is there a class, and its parent class has its own parent class, that is, does it contain multiple parent-child relationships? And there is a "subclass can inherit the method to manipulate the subclass of the inherited variables and methods", since the subclass does not inherit these variables and methods, why can you manipulate them? And how do I do it?
  6. The sixth chapter is mainly about interface, I think interface and abstract class is more similar, what is the difference between them? Can you only define constants in the interface body? This has been answered in the process of reading PPT after me. But why are constants only defined in the interface body? Why should there be such a limit?
  7. What are the advantages of the inner class, and what does it usually solve? About assertions, how do you make it work in the debug code phase and shut down when the program is working?
  8. In the eighth chapter, "The character sequence of a string object cannot be modified, and the memory space of the StringBuffer-class exclusive test can be changed automatically." "I wonder if the string class and the StringBuffer class have a specific environment in use?" This chapter has more analogies, how to distinguish them more clearly?
  9. The Nineth chapter refers to "direct sub-class" and "indirect subclass", I am not very clear about these two concepts. If my question in the fifth chapter is "whether it contains multiple parent-child relationships", then a subclass is the immediate subclass of its parent class, and is the indirect subclass of the parent class of its parent class?
  10. The tenth chapter mentions the concept of "file lock", in which case does the file lock generally use?

The first four chapters of the content I can basically understand, the fifth chapter can only understand the majority, the tenth chapter after the content of the understanding is not very good, feel that they can not be put forward by their own thinking of what to meet how to quickly read a book asked questions. Because there is no corresponding practice when looking at PPT, some definitions are often confused and can only be looked back again, wasting some time. The above is I read PPT after the problem, some is not perfect, will continue to add.

Java Learning goals and implementation methods
    • Through the next semester of the Java Curriculum Learning, in theory, I would like to be able to understand the object-oriented programming language design ideas; In practice, I hope to master this language skillfully, and use it to solve some problems. At the same time, I hope to play a subjective initiative, develop good learning habits, improve self-study ability.

    • First, I have to take a [comfort zone], learn in [learning area], and overcome fear. Second, you have to make small goals for yourself, such as practicing some code every day, and sticking to it, and at the same time, focusing on your weaknesses and practicing, solving those low-level problems, turning them into automatic actions without having to go through the brain, and then having time and brainpower to solve higher-order problems. . And in the course of practice to focus attention, so long-term persistence, you can improve the program design ability and cultivate computational thinking.

    • "Doing high school" in the article said: "Learning is to think, just practice is not enough: not only will do, but also understand the principle behind, not only will use tools, but also understand the theory of support. This shows that in Java learning, to combine theory with practice, learning theory and a lot of practice at the same time, in the practice of summing up. "Do Middle School" is the student as the main body, teacher-led learning style, I hope to improve their self-study ability, with the help of Blog Park and the code cloud these platforms, and strive to solve their own problems, but also to interact with the teacher, get timely feedback.

20165318 preparatory work Two basic research on learning basic and C language

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.