Home > Back-end >  Learning to program 1
Learning to program 1

Time:09-20

# include "stdafx. H"

#include
//n include called file contains commands, its significance is to put the Angle brackets "or" quotes & lt;> Within the specified file contains the rest of the program, as part of the program, the contained files are usually provided by the system, its extension. H
//n and the scanf printf is a standard input and output function, its header file for the stdio, h, also use the include command before the main function includes the stdio. H file,
//n stdio for standard input output of abbreviation, meaning "standard input/output"

Int main (int arg c, char * argv [])
//n int is to define the integral type variable identifier, char is
{
Printf (" hello, world! \n");//n Chinese hello, world! Output input function, the scanf printf () function

Printf (" helloworld! \n");//n English express hello, world!

Int a=12;//set a constant a, n values of 12

Int b=11; Set a constant b/a/n, value of 18

Int c=a> b;
Printf (" % d \ n ", c);//n determine the size of a and b, if a> B was set up, return the value of c=1, if a> B no set up, return the value of c=0

Int x=12;
Int y=10;
Int z=x * y;
Printf (" % d \ n ", z);//n arithmetic expression z=x y

Int d=x * y - a * b;
Printf (" \ n d=% d ", d);//n arithmetic formula d=x y minus a times b

Int f='b';
Printf (" \ n f=% d ", f);//n because double quotation marks because of 'b' said the letter "b", and the corresponding decimal ASCII small letter "b" in 98, so the output is 98,

Int s=b;
Printf (" s=% d \ n ", s);//n because b are defined as original 11, so the output is 11



return 0;//n return 0 and 1 has the function of the end of the program, return in some debugging tools, the main function returns 0 indicates normal program finished, return to the other values show abnormal end program, this is the "error code" in the program,

}

CodePudding user response:

CodePudding user response:

  • Related