use c++ Write a Hello World

In fact, it's very simple to do this , Let me show you the source code first .
#include<stdio.h> int main() { printf("Hello World"); return 0; }
okay , This is an output Hello World The source code of , Is it very simple ?

explain :

Although this is very simple , But I believe it may be a little difficult for people who have no foundation ( I'm just a little bit better ), But there's no problem explaining it to you .

#include< stdio.h>

( No need to understand , Just be a routine )
This is a c++ The beginning of the standard ( In short, it's the beginning of the routine of writing code ), Because the initial understanding of these words may be boring and lose the confidence to continue learning , So I'm just here to make a brief introduction, which can also be skipped directly , The function at the beginning is called , What function ?<> It tells you ,stdio=stand
input output, It's the standard I / O function ,.h What do you mean ? So this is a header file (h,head Abbreviation of ).

int main()

( No need to understand , Just be a routine ) This means the main function , In a nutshell , This is the main framework of your program , subject , That means there can only be one .

{ }

I don't know if you noticed , A string of things inside are all framed by this brace ? This curly bracket is the main function mentioned above int
main() Content of , It must be kept intact , That is to say, there is a {, So at the end, there must be one }.

printf(“Hello World”);

This is a function , A function of output ,printf=print
format, The translation is to format the output , What is formatted output ? You don't have to worry about it , I'll tell you how to use it .1, parentheses , Almost every function is followed by parentheses , What's in this bracket is what this function does ;2. semicolon , I don't know if you notice that every statement in the main function is followed by a semicolon ? This semicolon tells the computer “ This statement is over , You can go to the next one ”, It's a must , Otherwise, it will report an error ( Of course, there are some functions that can be left blank , I'll talk about it later );3.“Hello
World”, No matter what character you want to output in the computer , All need to be enclosed in quotation marks , In other words, anything enclosed in quotation marks will be regarded as the output of the original text by the computer , such as :“123456789” Then all the characters in the semicolon are treated as text characters by the computer , It will output the original 123456789.

return 0;

( No need to understand , Just be a routine ) This is the return value , Return content to main function , Of course, you don't have to worry about him , Not even writing , But it is strongly recommended to form a good habit of writing a closing statement .


Finally, I will introduce the software I use ——devc++, Compared with other software, the most important feature of this software is high fault tolerance , This is convenient for beginners to learn , Of course, we may develop some bad habits , But it is recommended to use this software for learning .

©2019-2020 Toolsou All rights reserved,
First knowledge python Skills summary GDOI2019 travels c Linguistic 5 Three common sorting methods Python Basic knowledge and notes " Cephalosporin wine Say go and go "? DANGER ! Don't drink alcohol when taking these drugs Thorough explanation from Zhongtai vue The component page height is adaptive according to the screen size Classical algorithm - recursion ( The case of raw rabbit ) Big data tells you , How tired are Chinese women about keras use fit_generator Encountered in StopIteration