A. programming fundamentals
1. language translaters: assemblers\compiler\interpreter
2. program developmeng:
create source code;
proprecessing(attach .h file added to .c source file; constrant macro change, etc.);
compile -> object code;
linker : obj-code + obj-code of C library -> executable file.
B. variables, arithmetic & expressions
1. An arithmetic expression is NOT a complete C statement; but only a component of a statement;
2. scanf needs '&' : scanf("%f%f", &a, &b);
3. complete format for int & float:
%[flag] [field-width] [.][precision] type (d/f/lf....)
4.scientific notation: %15.4e
C. the basis of C-math Functions
1. double(8), float(4), int(4); unsighed short int(2);
2. input buffer: (FIFO) receive & store value;
3. getchar() needs Enter to work, so an EXTRA '\n' will always be in the input buffer;
4. so flush the input buffer: fflush(stdin);
5. white-space is all the same to scanf
6. white a file: fprintf(file_pointer, format_string,argument_list); -> fprintf(myfile, "%d",date);
file_pointer is a (FILE *) get by fopen -> myfile = fopen("ntc.cc" , "w");
D. begging decision making & looping
1. it is NOT recommended to use '==' to compare double or float;
2. a good way is : if (fabs(a-b) < 10.e-10) {...}
==============TO BE CONTINUED==============
阅读(973) | 评论(0) | 转发(0) |