Learning Basics and C-language basic survey

Source: Internet
Author: User
Tags gcd

Learn basic and C language Basic survey one or one better skills than most people (over 90%)

To tell you the truth, I don't have the skills of someone who is particularly self-confident, who says that I can get a shot of more than 90% people. After all, there are people outside, heavens beyond heavens.

Let's count on chess, can be under some people, met some of the day under the kind of grandpa may still not be too defensive to come over.

As for the experience that I have accumulated, sum up, a lot of actual combat experience and flexible thinking mode .

First of all, it is a lot of practice. Some people like to play chess games, but I think the paper came to the end of shallow, or, I think real thing to a game faster than the back. In fact...... I did not think so much when I was a child, this is my blind BB now. My chess is a wild way to learn, as a child and grandparents under, a little bit of enlightenment skills will be. Later, the primary school, and the class under the students, to participate in competitions and so on. From the beginning to the end did not have a serious training class, so, in the end should learn how I do not know.

But I think it's a lot of help. See more routines, in the recruit more, nature can long memory.

So I now summarize this experience as: a lot of actual combat experience. As a child to lay the foundation, throughout the overall, indispensable.

Second, the dead brain still does not work, the thought must be flexible . In the game when the brain to think about a few steps to go where, there is no cheap to occupy, guess what the opponent wants to do, which there is no murderous, the game after the brain, the opponent fewest style, just have no errors, and so on. If you do not move your brain, then progress is a kind of wishful thinking.

Qinnengbuzhuo, static can give birth to Hui. I think this is the most common with the learning experience in the teacher's blog, and it is also the secret of all the ways of studying.

Ii. Survey of C language learning how did you learn C? What are the experiences and lessons of C language learning compared to your skill?

Just at the beginning, the basics of knowledge understand a little, some basic statements.

Then is the brush problem brush question ... The teacher gave the C language online bank.

Then slowly began to learn to look at the wrong information, find the wrong, learn to use Debug and so on, and then help students to change the program, some prone to the wrong place more and more skilled, to the end slowly began to communicate with the big boys, see how other people write.

In a word, it is continuous progress, I found problems to solve problems , check books, ask classmates, ask the mother, ask the teacher. This is my, the biggest harvest.

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?

(Teacher sorry to write how many lines C language code I really don't count AH)

Wait Ah, we now an experiment write program probably 100~200 line, so calculate down, we do so many big and small experiment, should have a small thousands of line.

At present the code is still able to understand, after all, are written by themselves, should not exist to see the problem; Other people's code is still to understand, just to see more two eyes, more pondering, may be the code to see less, not too skilled bar.

Quantitative change causes qualitative change, which is the inevitable law. I think we just slowly accumulate, natural Mickle, there is no need to deliberately pursue the occurrence of qualitative change. Perhaps one day we turned back and saw ourselves from the very beginning of the "Hello world! "To later can make a small application of their own, we will sigh imperceptible in the occurrence of qualitative change."

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

I don't know if I remember right.

An array pointer, which is a pointer to a pointer to an array, an array of pointers that are stored in an array.

function pointers are similar, function pointers are pointers to a function, a pointer function is a function, and a function return value is a pointer.

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?

The first question only knows a little bit ...

File refers to the computer storage device data information, the flow is simply supposed to be a byte sequence, file input and output control, external input and so on. Relationship: A stream is a way to write bytes to a file and read bytes from a file.

The second question ... I think broadly speaking, the text file is essentially a binary file ... So the difference between the two is not physical, but logical. Binary files can be stored in char/int/short/long/float/... Various variable values. As a special binary file, text files can only store char-type character variables. Therefore, the text file is usually fixed-length for each piece of data, and the binary file is not.

A text file Editor can read and write, such as Notepad, and a binary file requires a special decoder.

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

C language is process-oriented programming. The so-called process is, a mouthful of wine to drink, steps to go, what to do first, the order is very important, for the computer only need one to achieve the line.

The solution to the problem is to put a program into a modular, from the top down to step-by-step refinement can be.

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

When designing a larger program, it can be divided into a number of program modules, each of which includes one or more functions, each of which implements a specific function. C language uses functions to implement its modular functions.

More than one source program has not written, currently only write a source 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, low coupling" in fact, according to the literal meaning is also very understood, the program module and module coupling between the low, the interface is as simple as possible, the module inside to do a fine, the function function within the module is closely related.

The main problem in application is the division of modules. On the one hand, coupling should be considered: in order to improve the independence of the module, the connection between modules and modules should be reduced as much as possible, as far as possible in the main function, to achieve non-direct coupling; On the other hand, consider cohesion: to achieve a module corresponding to a function.

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.

(assuming an array of type char, length 5, array A is 1,2,a,b,c)

Copy the contents of the array a into the array B: The simplest is the toe loop, one corresponding to the write.

#include <stdio.h>#include <stdlib.h>int main(){    char a[5]={‘1‘,‘2‘,‘a‘,‘b‘,‘c‘};    char b[5];    int i;    for (i=0;i<5;i++)    {        b[i] = a[i];    }    return 0;}

How do I find the number 5 in an integer array a? The PIN loop lookup.

#include <stdio.h>#include <stdlib.h>int main(){    char a[5]={‘1‘,‘2‘,‘a‘,‘b‘,‘c‘};    int i;    int flag = 0;    for (i=0;i<5;i++)    {        if (a[i]==‘5‘)        {            flag = 1;            break;        }    }    if (flag)        printf("Bingo!");    else        printf("Not Found!");    return 0;}

How do I sort an integer array a (small to large, from large to small)? Bubble sort.

The following is a sort from large to small (sorted by ASCII code). From small to large only need to judge the conditions, from the “if (a[j]<a[j+1])” change “if (a[j]>a[j+1])” .

#include <stdio.h>#include <stdlib.h>int main(){    char a[5]={‘2‘,‘1‘,‘b‘,‘a‘,‘c‘};    int i,j;    int temp;    for (i=0;i<4;i++)    {        for (j=0;j<4-i;j++)        {            if (a[j]<a[j+1])            {                temp = a[j];                a[j] = a[j+1];                a[j+1] = temp;            }        }    }    for (i=0;i<5;i++)    {        printf("%c",a[i]);    }    return 0;}
Write a program to count how many lines of code have you written in C?

This is the code for the Chinese remainder theorem experiment in the sophomore year, after a week of knocking.

Chinese remainder theorem experiment # include <stdio.h> #include <stdlib.h> #define N 10000#define M 10struct equa//equation: bx = a mod n;    {int A;    int b; int n;};     int Modni (int a,int b);//modulo inverse m = a^ ( -1) mod bint gcd (int a,int b);//seek the maximum common factor int gcd (int a,int b)//The maximum common factor {int temp;        if (a<b) {temp = A;        A = b;    b = temp;        } while (b!=0) {temp = a% B;        A = b;    b = temp; } return A;   int Modni (int a,int b)//modulo inverse m = a^ ( -1) mod b{int v1=0,v2=1,q,temp;   if (a>b) {a = a% B;       } while (a!=0) {q = b/a;       V1 = v1-v2*q;       temp = b% A;       b = A;       A = temp;       temp = v1;       V1 = v2;   v2 = temp; } return v1;}       int main () {int x,xn;     Total number of equations struct Equa e[m],b[m];     Two equations, mutual write (bx = a mod n) int m0 = 1;      M0 is the Chinese remainder theorem of M int m[m];     M is the Chinese remainder theorem m int mm[m];      MM is the Chinese remainder theorem M ' int shit = 0;       Final result x = shit mod M0 int i = 0,j,k; Angular Mark int G1,g2;    The temporary storage location for the mutual decomposition of printf ("Please input the number of equations:\n");    scanf ("%d", &x);         xn = x;        Data retention if (x>m) {printf ("error!\nx>%d\n", M);    Exit (0);        } while (x--) {printf ("Please enter b,a,n:\n (bx = a mod n) \ n");        if (scanf ("%d", &e[i].b) &&scanf ("%d", &e[i].a) &&scanf ("%d", &AMP;E[I++].N)) continue;            else {printf ("\nerror!");        Exit (0);    }} for (i = 0;i<xn;i++)//calculate M M0 *= E[I].N;    for (i = 0;i<xn;i++)//calculate m m[i] = M0/E[I].N;    for (i = 0;i<xn;i++)//Calculate M ' mm[i] = Modni (M[I],E[I].N);    for (i = 0;i<xn;i++) shit + = M[I]*MM[I]*E[I].A;    shit = shit% M0;    printf ("x =%d mod%d", SHIT,M0);    Program Test section/*for (i = 0;i<xn;i++) {printf ("%DX =%d (mod%d) \ n", E[I].B,E[I].A,E[I].N); }*/}

The original program is too long, I changed it, now this code can only solve the very simple equation. This program Qiatouquwei a total of 91 lines of code.

Do you know what a breakpoint is? Give an example of your own debug program.

A breakpoint is where the program will automatically stop when it runs, and it should be accurate to stop when the program runs to the breakpoint during debugging.

Program debugging.

Program run results.

Third, refer to how to quickly read a book, quickly read the cloud class has PPT, each chapter presents a question 1th chapter

Java's dynamic features are not quite understood.

2nd Chapter

Why is there a "boolean off = False"?

3rd Chapter

3.1.5 examples do not understand ...

4th Chapter

Do not understand that Java supports Chinese class names, method names, property names, and does not cause run-time links to fail because of garbled characters. This is determined by the Java Kernel Support UTF-8 feature. ”

5th Chapter

Do all classes have their own subclasses?

6th Chapter

Does not understand the specific differences between interfaces and abstract classes.

7th Chapter

The exception class does not understand.

In the eighth chapter, I have a basic face to be forced ... The back of the learning side asked, I feel this semester Java learning will let me reap a lot.

Iv. About Java Learning

The study of computer language I think is the code heap out. Language learning can not be separated from the environment, but for computer language, code is the environment. To improve the program design ability and to cultivate the computational thinking, RUANMOYINGPAO training is essential. "Doing high school" requires us to have flexible thinking, to get rid of the "comfort zone" and enter the "Learning area".

Learning Basics and C-language basic survey

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.