, '
. :
1. ', ( ) ( , , ..) ;
2. , ' ;
3. , ' . ' . ( , ) ' . ³ ( ) .
. 1.12, F1 F2, , , . , , . 01 02, , , , , . , , , , . , , , , , .
-, . , , . -, - , , , ; . .
1.12
F0, F1, F2 , ;
j -1/2 ; S ; ' ; , ; 01, 02 , ; 0', 0" ; 01', 01" 01 ; 02', 02" 02 ; 0"' .
( ), - , , , .
|
|
() 2j ; j.
- , , , . . , , , , . ', , , . .
( ) , . , ( ), . , , . , . .
' . , , . , , -. ' , , .
³, 㳿 , . . ' . , , . , , ' ' .
, "" . ' , 1,5-6 . () , , .
|
|
, , . (500 - 2400 .) . ҳ .
³ , , .
' 256×256, 320×320, 512×512 1024×1024 . , . , , , [2, . 10 - 13].
48 C++: \n, \t, \r.
\r , , , \x0D, 0x0D (13)
\n , , , \x0A, 0x0A (10)
\t , 0x09 (9)
\0 , 0x00 (0
\x00 - \x1f, .
\x , ,
49.
()- ' , , - .
, ' . - .
' , , ( 200), - 10 . 40-50 . ' 1-2 .
65.
(. operator) - , , (, +,-,%, <<). , ́, : , . , , . . , , , , , .
. , , . (. statement), . . statement () . 㳿 , . , , if-statement if [1] -if [2] (. : ()).
|
|
, . . -?:
.
-5 -
not false - " "
:
5 + 3 -
5 < 4 -
[3]:
+ | += | ||
- | ( ) | -= | ³ |
* | * = | ||
/ | ij | /= | ij |
% | ij | %= | ij |
++ | ( 1) | -- | ( 1) |
+,-,++,--;
+,-,*,/,%
³:
<,>,<=,>=,!=,==
!, &&, ||
?:
:
!,&,|
3 -, : < 7 - , = 7 - , > 7 - .
4.. C: \n, \t, \r.
\r | |
\n | |
\t |
// in_out.cpp: .
#include "stdafx.h"
#include <iostream>
using namespace std;
int main()
{
cout << "\t\tcontrol characters C++"; //
cout << "\rcppstudio.com\n"; //
cout << "\'nformatting\' output with \"escape characters\""; //
cout << "\a\a\a\a\a\a\a\a\a\a\a\a\a\a" <<endl; //
system("pause");
return 0;
}
5 ..
. . ' , .
- . - . ̳ ' '. - [10].
, 1928 ( ). - :
I = l log h,
I - , ; l - ; h - .
{0,1}; l = 1; h = 2 2, :
|
|
I = 1*log22 = 1.
(BIT - Binary digiT) : , . [11].
'. , .
, () . , .
56. '.
' .
. ' . , (: , ; : , ).
. . ' .
(), . ʳ , , . , , . , , , , , , , , . ' . ( ) - . . , - . . , , ² . : ' . ( ) - . . - ' . , , ', () -. , . ' . , , . ' ² , '.
55.57 셅
++: |, ^,||, &&.
:
boolean,
& | (AND) |
| | (OR) |
^ | (XOR) |
|| | |
&& | |
! | Ͳ (NOT) |
&,|,^ .
|
|
.
class BoolLogic {public static void main(String args[]) { boolean a = true; boolean b = false; boolean c = a | b; boolean d = a & b; boolean e = a ^ b; boolean f = (!a & b) | (a &!b); boolean g =!a; System.out.println(" a = " + a); System.out.println(" b = " + b); System.out.println(" a|b = " + c); System.out.println(" a&b = " + d); System.out.println(" a^b = " + e); System.out.println("!a&b|a&!b = " + f); System.out.println("!a = " + g); }}:
a = true b = false a|b = true a&b = false a^b = true!a&b|a&!b = true!a = false(||) (&&) (false), . . :
int r=50, k=4; if (k!=0&&r/k>10) System.out.println("r k"); // k , 10
19. í é .
( ):
.17.1.
', , . - : , ', ,
:
o ( , ' );
o , ;
o ( , , );
o ( , , , );
o ;
o ;
o , ' ;
o .
, . . .
, , , . , . , ', , , , . ϳ ().
- - .
. .
' , . () , .
' . , , , .
53.
AND ( ) | & | |
NOT ( ) | ! | ! |
AND (&) ( ) , , ,
1: 0 1 0 1
& 2: 0 0 1 1
1: 0 1 1 1
54.
, ᒺ . ᒺ , , . . ֳ . . ̳ ᒺ . . , , , , . , , , . , , .
while()
, , . , , . while() for(). while() . :
while() ;
while ( ) , true. , , (, ).
<?
$i = 0;
while($i < 10) $i++;
echo $i;?>
10 ( ) $i , $i 10, $i < 10 false, while(), $i. , :
<?
$i = 0;
while($i < 10){ $i++;
echo "i = $i<br />\n";
}
?>
$i , 1 10.
while, , , .
while . . while, , , . :
do while();
, . - , . :
<?
$i = 20; while($i < 10){
$i++;
echo "i = $i<br />\n";
} $i = 20; do{
$i++;
echo "i = $i<br />\n";
} while($i < 10);
?>
while() , $i, 10, . , false, , - ( 21).
break continue. - , break; continue . break , , , continue (, ). break:
<?
$str = " ";
$word = "";
$index = 0; while($index < strlen($str) - 3){
if(substr($str, $index, 4) == $word) break; $index++;
}
if($index == strlen($str) - 3) echo " '$word' '$str'";
else
echo " '$word' '$str' $index";?>
, .
$word $str. , strpos(), break. $index $str, , $index 0 ( ) . , , , , (4), . , : , , .
ʳ $str strlen($str). . , . $index, break. substr($str, $index, 4) , $str $index 4 . , , ($word), if() break.
ϳ , , . , , . , , . $index == strlen($str) 3, $index . , $index . , . , .
, , continue.
<? $numbers = array();
while(count($numbers) < 10){
$random = rand(1, 100); if($random % 3) continue;
if(in_array($random, $numbers)) continue;
echo "$random<br />\n"; $numbers[] = $random;
}
?>
10 1 100, 3 .
rand(), . , 10 , , , .
$numbers = array(). , 10- ( count(), , 10).
$random. ϳ , 3 , 3 0, , if($random % 3) , continue , . , , $numbers. , in_array($random, $numbers) true - continue. ( in_array($random, $numbers) false) $numbers ($numbers[] = $random).
:
1.
2. , , ,
3. while() ,
4. do.. while() , while()
5. break , continue
76.
. , , , .
, : , , , , , , , .
, ' , , , .
, ' . () , (). (). .
. 1.1. ᒺ
, , ( ), / ( ) ( ).
, , , .
( ).
, .
. .
. , , , .
Գ . ³ , . ϳ .
. .
. . .
. , , .
. .
. .
, .
70. ' - , . [1] , ' , , - . , , ' .
' ' , '.
1.
. , "" - . - .
[2] .
, - 2. ³ - - .
, 3 () log 3 ≈ 1,585 , 10 () - log 10 ≈ 3.322 .
(nat), . , .
' ( ) .
2. ,
ֳ , .
4 - ( , , ), , .
8.417-2002 | Ѳ | |||||||
2 0 | - | 10 0 | B | 2 0 | ||||
K | 10 | - | 10 | KiB | ʲ | 10 | ||
20 | - | 10 | MiB | ̲ | 20 | |||
30 | - | 10 | GiB | ó | 30 | |||
2 40 | - | 10 | TiB | 2 40 | ||||
? | 2 50 | - | 15 | PiB | ? | 2 50 | ||
? | 2 60 | - | 18 | EiB | ? | 2 60 | ||
? | 2 70 | - | 21 | ZiB | ? | 2 70 | ||
? | 2 80 | - | 24 | YiB | ? | 2 80 |
8 , ( ). ( ) , ' .
. ., , .
2.2. ʳ
"" = [1024] "" [3] (, kibibyte) = 1024 ( . ). , :
512 , .
"" UNIX (1024 ).
" '" x86 ( Intel 80386) 4096 , 4 .
, "3,5" " 1440 (), .
"" = 1024 = [1048576] "" [3] (, mebibyte) = 1024 = 1048576 .
Intel 8086 1 .
' CD-ROM (, ), .
, , .
2.4. ó
"" = 1024 = [1048576] = [1073741824] "" [3] (, gibibyte) = 1024 = 2 30 , . г 7%.
32- 4 ≈ 4,295 . DVD-ROM -'. .
(10 12 2 40 ), (10 15 2 50 ) . .
3. ""?
, ' ', ' 8 ( ' ' - ., : '). , .
() B () (B) 8 , "" .
ϳ o, Ko, Mo . . ( octet) , 8 .
4. ""?
1000 1024 . :
, 8.417-2002 "", "", "" . . ( );
, , . ., ( , ),
, , 10 3, 10 6, 10 9 . .
"", "", "" . . "", "", "" . ., .
. , 㳿 , .
"" = 1024 K, Ѳ . , , "".
40. , -, , , , , , .
- ' -. , , . -. - , . , . -. - . -, - -, . - , -. , , -, . - ' , , , .
, -. . , , .
, , -, , .
-. , -, , , - , ' , , , ', .
41. (||) (&&) (false), . . :
int r=50, k=4;
if (k!=0&&r/k>10) System.out.println("r k"); // k , 10
42. ij 㳿 , . 5.
㳿 . , , ' , . -. : , , .
, ' ' , . , , .
"'" . , , () . -. , ', , , , -. , . 㳿 : ( ), (- -, , - ).
㳿 1- . "1 - " , 㳿 -. .
(. ) , . 1, - 0. -. . " - ". ij-. , . -. , , . , , .
㳿, -, , . -. .
' , ' . ϳ ', -, , , . ', , -, , . , -. ' , . ' . , -. . ' : '; , ; ; ' -, , ( ').
ϳ ', ' . ' , -. , , '.
1- , . , , , . - , ' .
58.
:
, . ;
, .. ;
, .. , .
, . :
- ;
--, ;
-, , .
59.
( ). : ++ . ? 1, - 1.
, . . , , :
=+1 +=1.
, 1, . :
++
. () . . C : . ++ (, ) - . :
, ;
1.
, :
++ ,
. :
1;
.
. :
int t=1, z;
z=(t++)*5;
t*5, t. z=5, t=2.
int s=2, f;
f=(++s)/3;
s , . s=3, f=1.
!
, , , , .
, . . ++(-1) .