21 Actual C Language Tutorial-2

zhaozj2021-02-16  53

Affirming: It is actually very sorry for 9CBS. There is no valuable thing in it. Just try to use the most lightweight text to guide the most idiot. Let's take a look, don't blame the content. If there is any suggestion, send it to mo2mo@163.com

Chapter II Shallow Taste

Where to start, it is always a problem. Before writing here, I have written another version of the second chapter, very unsatisfactory, so I will come once again. Now, I think there is a short example as a promotion. The first example is to let the computer TELL you: You are a programmer. The code is as follows: #include main () {Printf ("You are a real programmer!");} There is a problem here. Give you this code. How to enter the code how to execute to complete what I said, let you tell you: You are a programmer. How to? I want to know, but maybe it may not. I have no way to find a textbook, there will be introduced, or ask the people around. The result of the run is to display a line you are a real programer in a black word in a black and white window. It is definitely true because the computer is saying this (note one). But it may also be flashing with that window, and I haven't seen anything. For example, the old TC2 is that, I recommend you use the VC's console program. If you can't see it. #include main () {Printf ("You Are A Real Programmer!"); System ("Pause");} Plus a System ("Pause"); you can make the program waiting for you there, know You will only quit after pressing a key. Do you understand? I don't understand it. Let's analyze it. Unless you are born in the 19th century, then everything you do is impossible to start. It's all in the 21st century, of course, you need to take advantage of the former. Just like the current car manufacturer will not go to the wheels, you will not go to the screen to achieve such a function (of course, now you don't know how to implement), only use it. Printf is something that others write, you use this thing (huh, huh, I really don't know what is called, is it a function, is it macro?), You can output the text you want on the screen. But with the free "wheel" without the world, you need to give the wheel manufacturer's order, here you need #include this sentence, then you can use the Printf this to give you (exactly C) Standard library) function. SYSTEM ("pause"); what doesn't worry, know what it will be like this sentence. And to understand that main () {}. Strange things, curly brackets (big brackets), rarely see. But in C, C , Java, it is common. Everything has a starting point. There is no need to explore the origin of the universe, and the process of writing is entry (start execution), which is this main (), {} is main () content. That is to say, the program starts with the first row after {, is Printf ("You Are A Real Programmer!") ;. Then sequentially, until the end. Is there anything else?

There is also that semicolon. Nothing, add a semicolon, that is the line end of the programming language. Regarding the programming, many things don't make sense, just remember. Forget the semicolon, and multiple sections is a common thing for beginners, pay more attention. Note 1: This example has other books. It is the example of the book, let me get the confidence of the initial programming, so I still use that example here. As for the display, it is really no way, and the beginner program can only write something in this character interface. The colorful looks under Windows temporarily thrown, black and white two colors can make you concentrate on programming itself, rather than various fancy input and output interfaces. I am familiar with C, understand the method of program writing, that is, when you go to learn more about the program interface. Don't be discouraged, even the character interface, it is also very fun.

转载请注明原文地址:https://www.9cbs.com/read-26610.html

New Post(0)