Home > Back-end >  Into the first class C (for zero basis)
Into the first class C (for zero basis)

Time:11-22

In fact, c + + is very simple,,,,,,,
Said the software, I personally love with Dev - c + + to write c + + program, it is a personal hobbies, but the following content is to use Dev - c + + to compile,
First show the most simple c + + programs:
# include & lt; Iostream>
using namespace std;
Int main ()
{
Int a;
Cin> a;
coutreturn 0;
}
To explain the code below,
The first sentence # include & lt; Iostream> : in c + + USES a function need a header file, general format is # include & lt; Header name & gt; And the iostream includes two header files stored function prototype cost and ostream, they contain some function prototypes,
Second statement: using namespace STD. Use: using mean, the meaning of the namespace is a namespace, the meaning of the whole line of code is a program will use the STD namespace, the STD namespace contains what did not elaborate,
The third sentence: int main () : call here the main function, in order to run the following {} functions in the body, no parameters in its () says it has no return value,
Inside the function body: enclosed by braces, is run part of the program,
The next part about running: int a;
Cin> a;
coutreturn 0;
Int a; Said to define an integer by the name of a function,
Cin> a; And cout And & lt; return 0; Pairing is and int main (), specific what use here is not, but in the program proposal along with it,
Explaining the code, there is also a must say: annotation, annotation is used of heading//some explanation, good code have a comment, it is not only useful for readers, and for a long time didn't contact the author of this code is very useful, and the program won't recognize these words, can be added behind the code, can also be a separate line,

CodePudding user response:

will knot stick? Pick up points
  • Related