++
. . 417021-12 ..
. .
2013
:
. 3
. 3
1. .. 3
2. .. 7
2.1. .. 7
2.2. . main(). 8
3. . 21
. 22
. 23
1. .. 24
stdafx.h. 24
stdafx.cpp. 25
.cpp. 30
2. . 31
, , . . , . . .
++. , : . , , , . , : , , . . .
++: , , , , , , .
, . , . :
- ;
- , ;
- , .
++ () . ++ 6 :
- int ():
- char ();
- wchar_t ( );
- bool ();
- float ();
- double ( );
4 , :
- short ();
- long ();
- signet ();
- unsigned ();
, void, . , , , .
|
|
:
[ ] [const] [],
:
- ( , ). auto, extern, static, register. , ;
- const , . , ;
- .
. , , , , , .
. , (). . . :
float a[10]; // 10
int b[] = {1,2,3}; // b[0]=1, b[1]=2, b[2]=3
char str[10] = // . 10
// 0 9.
// : , , , , \0 .
, . ++ 3 , , void. , .
, , . . , . , .
, .
void , , , (, ).
:
int func (int, int){}; //
int (*f) (int, int); //
f = func; //
int a = 5; //
int *p = & a; //
int b[10]; //
int *t = b; //
(*), , . , ( ).
(enum).
, , ( ). , .
enum [_] { },
|
|
, .
(struct).
, , :
struct [ ] {
_1 _1;
_2 _2;
_n _n;
} [ ]
, , . , , . . , , .
. (, ).
, . .
. () - > .
(union).
, . . . , , .
, , .
, . .
++ , main ( ). . . , , . , .
(, , ) . , , , . , . , , ( ).
. , , , , .
, ; , . .
2 :
- ;
- .
, . , , , .
|
|
, . .
Microsoft Visual Studio 2010.
, , :
struct Worker{
char surname[20]; //
double salary; //
bool be;
}
bool be; , , (bool be= true), (bool be= false).
, . , , , :
for(int i=0;i<n;i++){
strcpy_s(work[i].surname,"0");
work[i].salary=0;
work[i].be=false;
loc_number[i]=&work[i];
},
:
loc_number[i] ;
&work[i] .
, , . . : .
, , : stdafx.h .
: stdafx.cpp .
main() .cpp , stdafx.cpp .