Академический Документы
Профессиональный Документы
Культура Документы
2.
2.
( .) :
prog.c
/*
*/
#include
#include <stdio.h>
main,
int main()
int a, b, c;
c = a + b;
printf(%d+%d=%d\n,a,b,c);
return 0;
}
2.
#include
:
-
-
/
<limits.h>
<float.h>
<stdio.h>
<stdlib.h>
<math.h>
<ctype.h>
<string.h>
<time.h>
<stdarg.h>
<locale.h>
<conio.h>
2.
()
/ :
int
getchar( void ); - ;
int
putchar( int ch ); - ch ;
: int,
/ .
EOF - ,
/.
EOF
stdio.h.
2.
()
...printf -
.
,
.
- ,
:
, ;
( %).
[][][.][F|N|h|l]_
, ,
().
, .
2.
()
, ...printf
______________________________________________________________________________
______________________________________________________________________________
d
a, b, c, d, e, f
X
, x, A, B, C, D, E, F
f
e
g
E
G
[ - ] ...dd.dddddd
[ - ] d.dddddd e [ +/- ] ddd
e f
;
, e, E
, g, E
c
s
, '/0'
%
n
( )
int
2.
()
______________________________________________________________________________
______________________________________________________________________________
n
n ,
n , ;
0n
n ,
,
n;
...printf,
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
- :
1 - d, i, o, u, x, X,
6 - e, E, f
- g, G,
'\0' - s
.0
- e, E, f -
.n
- d, i, o, u, x, X - n ;
n ,
n ;
n ,
-
- e, E, f - n ;
- g, G - n
- s
- n
______________________________________________________________________________
2.
()
...printf
______________________________________________________________________________
______________________________________________________________________________
-
;
- ,
- d, i, e, g, E, G :
(
+)
-)
- "" :
c, s, d, i, u
- 0
x, X
- 0x 0X
e, E, f
g, G
- e E
______________________________________________________________________________
. .
(
+ ) , "", .
2.
()
...scanf - .
, .
- , :
""
""
, ;
ASCII "" %;
%.
"" .
"" , ...scanf
""
"".
"" , ...scanf
,
- .
10
2.
()
%[*][][F|N][h|l|L]_
, (
, !), ()
- ( );
- , ,
"" .
F|N
h|l
L
- - long double.
11
2.
()
...scanf
______________________________________________________________________________
-
______________________________________________________________________________
d
int *arg
o
i
10-, 8- 16-
u
10-
unsigned int *arg
x X
16-
int *arg
fe g E G
float *arg
s
char arg[ ]
c
%[^abcd]s
.
12
2.
()
...scanf :
1. "
.
2. EOF.
3. .
...scanf (
) EOF ( sscanf ).
. ...scanf - ,
, ,
.
, - .
. 23-feb-89 - ,
.
"" .
13
2.
()
1. ( )
- double >=x;
- double <=x.
- x y.
3.
2. ,
double
double
double
double
double
double
x.
x y.
10 x.
( e x ).
x.
x.
4.
double
double
double
double
asin( double x );
acos( double x );
atan( double x );
atan2( double y, double x );
14
2.
()
int rand(void); - pow(2,32) ,
0 RAND_MAX.
void srand(unsigned seed);
- .
- ,
,
;
status ( 0
, - - ).
15
2.
()
6. ASCII
int
is...( int
ch );
0 () != 0 ().
- :
isalpha
islower
isdigit
isascii
isgraph
isspace
('A'-'Z', 'a'-'z')
('a'-'z')
('0'-'9')
(0x00 - 0x7F)
(0x21 - 0x7E)
(0x09 - 0x0D, 0x20 )
('A'-'Z')
('A'-'Z', 'a'-'z', '0'-'9')
('0'-'9', 'A'-'F', 'a'-'f')
( 0x20 - 0x7E )
( 0x7F 0x00 - 0x1F )
( iscntrl isspace)
16