СПО_Praktikum_k_lab_rabotam
.pdf1
!
" #-% & " '
. .
2012
2
621.3.037.3 (075)
, . . ! " #: !". !-
& / . . . - ( ) (*+,, 2012. - 87 .
. / ! 0 / # & !1! ) / ) 0 ) !" !-
02 !" & & « ! " #». 5!" ! 06 ! & / !1 !# / ) &/ # 6
7 0 " ) 8 ! 9 071900 – «+ 7 !8 0 - 0 2 » ! ! < / "! ! ! 230400 – «+ 7 !8 0 0 2 » # 6 1! # 6 7 " )
3
Оглавление |
|
|
||
................................................................................................................. |
|
5 |
||
1. |
& )1. * +,- -. / 0 -1 /23-- |
|
||
/456.................................................................................................................. |
|
7 |
||
|
1.1. > 9 !" 0...................................................................................... |
7 |
||
|
1.2. , # !) #! 9........................................................................ |
7 |
||
|
1.2.1. |
, 0 /! 02....................................................................... |
12 |
|
|
1.2.2. . 7 !8 / !.............................. |
13 |
||
|
1.2.3. . 7 !8 " / ! /.... |
14 |
||
|
1.2.4. . 7 !8 " !8 6 ....... |
16 |
||
|
1.2.5. . /! 02 &? 6 /...................... |
17 |
||
|
1.3. . 7 !8 ! ) ............................................... |
17 |
||
|
1.4. @!/! ! !" ! &< !" & ................................................ |
18 |
||
2. |
& )2. *- 12 4 /2. '2 .5 1 ........ |
19 |
||
|
2.1. > !" ! 6 !" 0 .......................................................... |
19 |
||
|
2.2. A 0 / ) /!2 ! 7!6........................... |
19 |
||
|
2.3. / B! !" 0....................................................................... |
26 |
||
|
2.4. . |
)/ 0 ) !" 0 ....................................................... |
26 |
|
|
2.5. , " ! ) / B! < # ! ............................................... |
26 |
||
3. |
& )3. *- 12 4 /2. '2 .5 2 ........ |
27 |
||
|
3.1. > 9 !" ! 6 !" 0........................................................... |
27 |
||
|
3.2. , # !) #! 9...................................................................... |
27 |
||
|
3.3. . |
)/ 0 ) !" 0 ....................................................... |
35 |
|
|
3.4. , " ! ) / B! < # ! ............................................... |
35 |
||
4. |
& )4. -.2-,-0 2;< |
|
||
=,-/ 0 .-............................................................................................... |
37 |
|||
|
4.1. > 9 !" 0.................................................................................... |
37 |
||
|
4.2. , # !) #! 9...................................................................... |
37 |
||
|
4.2.1. |
.) &............................................................... |
38 |
|
|
4.2.2. |
! # 6 !1" ......................................... |
39 |
|
|
4.3. ! ! 0 1!/! 6.......................................................................... |
43 |
|
|
4 |
|
4.4. C / 0 ) !" 0 ............................................................... |
44 |
|
4.5. / B! # !........................................................................ |
44 |
|
4.6. 9 0 0................................................................... |
44 |
5. |
& )5. |
4 2- 4 3 2/- |
Windows..................................................................................................................... |
46 |
|
|
5.1. > 9 !" 0.................................................................................... |
46 |
|
5.2. , # !) #! 9...................................................................... |
46 |
|
5.3. ! ! 0 1!/! 6.......................................................................... |
51 |
|
5.4. C / 0 ) !" 0 ............................................................... |
56 |
|
5.5. / B! # !........................................................................ |
56 |
|
5.6. 9 0 0................................................................... |
56 |
6. |
& )6. |
;F2- / G 4 . , =H |
4-I-0 F Windows.............................................................................. |
57 |
|
|
6.1. > 9 !" 0.................................................................................... |
57 |
|
6.2. , # !) #! 9...................................................................... |
57 |
|
6.5. ! ! 0 1!/! 6.......................................................................... |
63 |
|
6.6. C / 0 ) !" 0 ............................................................... |
63 |
|
6.7. / B! # !........................................................................ |
64 |
|
6.8. 9 0 0................................................................... |
64 |
* * &J |
||
& K ........................................................................................................ |
65 |
5
< 2- F I2-6 - 1 /-6 ., .2.
A # !" ! 6 !" 0 ) ) ! !2 7 ! ! 2102297 . 6 0 ! / B "0 9 ! D-
6 25 , ! 6 – 15 , 2& – 20 , 1& – 25 . !- 80 ) 9 6 1! & &< ) 2& / !. , # ! !" ! ) 91 ! D 7 ! Times New Roman Cyr !1 12 ., 0 ! ! – D ! 80. E B # 06 ! – / ! 06. "1!8 06 & – ) 9 #!- 02 1 ! (1,27 .). @! / ) 9 ! 2& 1&
/ & ) B # 0 ! !.
) ! ! 91& ) D 06 D 7
Courier New !1 12 .
) ) #! 9 1!# !, # 0 !" !- 0 !" ! / B 0 "0 9 " D< ! 0 ! / / &. A" !- 1 8 & 9 ! # ! / ) B.
) /!# 1!# ! &/ / B 9 # !" ! 6 !", ! 06 / 06 1! & & ) 06 /& 9
! 0.
A # / B / B! 9 1& 9 ! 0 02 ! # /- B/!<? 2 ! 9 9 !" 0 ! 0.
< 2- 1 /-6 4 G 2// =H 4 F+ ..
! 0 D& ) / Visual Studio 2008 ! )10
C++.
. ! 0 !"B!< ) / ! # 0 # !-
"2 / 02 / ) ! ) & ! ! ( / /
! 6 ! 10 ! /!). F "2 / ! B
6
9 /&, # G ! / B 0 & ! 9 9
# & ! 9 / ! / ! ) 1!? + ) ! / B !B! 9 & 9 D! 6 1!/!#.
!B/!) ! ! !"B! ) / 0 ! ), )- )<? !1 !# / B!? / ) " !. .
/ " 6 / & !8:
////////////////////////////////////////////////////////
//1.
//: " ".
//! "# # . $.
//% " -201.
////////////////////////////////////////////////////////
7
1.& )1.
* +,- -. / 0 -1 /23-- /456..
1.1.! 5 2< .=
> 9< !" ! 6 !" 0 ) ) ) 1 ! 0
6D 7& 8 ) VC++, 1 )<? 9 &<
7 !8 < " K E.
1.2..-, 2 ,2 .5
/! 6 !" ! 6 !" / ! ! 9 ! &, 0 /)?&< ! G ! ! 06 7!6 /! 0:
1) !8 6 0;
2) !2 /;
3) " / ! 2 # 2 / !2
4) /! 0 ! );
5) /! 0 &? 6 /.
N. 1.1. / B 7!6 ! 7 !8 6 9<.
. / B -
7!6 !, 06 / B "0 9 1/! !1 !" ! 6 ! !2 !"- ! 6 !" 0 ! 6, !- 1! ! . 1.1.
F! ! !) ! ! ! / B ! B /, / ! 06
1.1:
&- .- G 1.1. M ! /! - ! 0, 0 /)? 6 ! G ! -
! &< &< 7-
8
!8 < " K E.
#include "stdafx.h" #include <iostream>
#include <fstream> // ! ofstream #include <cstringt.h>
#include <locale.h>
//= > =?
//! ?
void HardDriveComputer(std::ofstream *file); // OS
BOOL SystemVersion(std::ofstream *file); //
void MemmoryStat(std::ofstream *file);
// P ! void CurrentDir(std::ofstream *file);
using namespace std;
/////////////////////////////////////////////////////////////
// % #
int _tmain(int argc, _TCHAR* argv[])
{
char szNameFile[_MAX_PATH] = "MyFile.txt";
setlocale(LC_CTYPE, "Russian_Russia.1251");
//>! b file ! > ! =? #
//szNameFile
ofstream file(szNameFile);
//c
SystemVersion(&file);
//! ?
HardDriveComputer(&file);
MemmoryStat(&file);
//P !
CurrentDir(&file);
file.close();
cout << "\nf = > = # #= : " << szNameFile << endl;
cout << "c - # g\n"; system("pause");
return 0;
}
9
//////////////////////////////////////////////////////////////////
// ! ?
void HardDriveComputer(std::ofstream *file)
{
char szFullDisk[20]; char cLetterOfDisk; BOOL bFlag;
UINT uTypD;
char szTypD[100];
//# ! # !
__int64 nFreeSpace;
//o # #
DWORD dwBytesPerSector;
//o # # #
DWORD dwSectorsPerCluster;
//o # # ! =? #
DWORD dwNumberOfFreeClusters; DWORD dwTotalNumberOfClusters;
for(cLetterOfDisk='A'; cLetterOfDisk<='Z'; cLetterOfDisk++)
{
sprintf_s(szFullDisk, sizeof(szFullDisk)-1, "%c:", cLetterOfDisk);
uTypD = GetDriveType(szFullDisk); switch (uTypD)
{
case DRIVE_UNKNOWN:
sprintf_s(szTypD, sizeof(szTypD)-1, "%s", " Unknown Drive\n");
break;
//xfy z fc {y| }~ z c$y•y| ocf ! =?
//# ! #.
}
bFlag = GetDiskFreeSpace(szFullDisk, &dwSectorsPerCluster, &dwBytesPerSector, &dwNumberOfFreeClusters, &dwTotalNumberOfClusters );
if(!bFlag) continue;
//o # # ! • ! # ?
nFreeSpace = __int64(dwNumberOfFreeClusters)* dwSectorsPerCluster*dwBytesPerSector;
//x =# #
*file << "\nDisk: " << cLetterOfDisk << szTypD << "=====================================\n";
//xfy z fc {y| }~ z c$y•y| ocf ! #=# !
//! # .
10
// ‚=# ! ƒ
cout << "\nDisk: " << cLetterOfDisk << szTypD << "=====================================\n";
//xfy z fc {y| }~ z c$y•y| ocf ! #=# !
//! ƒ .
}
}
//////////////////////////////////////////////////////////////////
// # c
BOOL SystemVersion(std::ofstream *file)
{
OSVERSIONINFOEX osvi;
// " > osvi osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); if(!GetVersionEx ((OSVERSIONINFO *) &osvi))
{
return false;
}
switch (osvi.dwPlatformId)
{
//# # Windows NT. case VER_PLATFORM_WIN32_NT:
//# .
if ( osvi.wProductType == VER_NT_WORKSTATION )
{
//xfy z fc {y| }~ z c$y•y| ocf ! #=# !
//.
}
// # #.
else if ( osvi.wProductType == VER_NT_SERVER )
{
//xfy z fc {y| }~ z c$y•y| ocf ! #=# !
//#.
}
//c … #, service pack ( ),
//!.
if ( osvi.dwMajorVersion <= 4 )
{
cout << "version "
<<osvi.dwMajorVersion << "."
<<osvi.dwMinorVersion
<<osvi.szCSDVersion
<<"(Build "
<<(osvi.dwBuildNumber & 0xFFFF)<<")\n"; *file << "version "