1.1. Helloword.
/* Hello, World!,
*
* .
*/
#include <iostream>
using std::cout;
int main (void)
{
cout << "Hello, World!";
system("pause");
return 0;
}
, , . . , // . , , , /* */. .
, . , , - , . , , , . , , , , . , . , , , , , .
1.2. main
main, . main , , .
(), , , int, . {}, , . . . , , . system() "pause". , . .
1.3.
, , . , _ . ++ , .. variable VARIABLE . , .. . , . tmp, , .
|
|
1.1. .
and | char | dynamic_cast | goto | not_eq | short | try |
and_eq | class | else | if | operator | signed | typedef |
asm | compl | enum | inline | or | sizeof | typeid |
auto | const | explicit | int | or_eq | static | typename |
bitand | const_cast | export | long | private | static_cast | union |
bitor | continue | extern | main | protected | struct | unsigned |
bool | default | false | mutable | public | switch | using |
break | delete | float | namespace | register | template | virtual |
case | do | for | new | reinterpret_cast | this | void |
catch | double | friend | not | return | true | volatile |
wchar_t | while | xor | xor_eq |
, , . namespace. , . . , .. () .
::. , , Math Complex, Pow(), : Math::Complex::Pow(). , . using. : using namespace Math::Complex. using Math::Complex::Pow. , . , Complex , .
using namespace std; std. iostream, #include <> "".
1.4.
, . ++ , 64- x86.
++ sizeof, . , , float sizeof(float).
|
|
, signed, , unsigned. , , , , , . short -32768 32767, unsigned short 0 65535.
1.2. .
long double | |||
double | |||
float | |||
long long | |||
long | |||
int | |||
short | |||
wchar_t | |||
char | |||
bool |
short, int, long, long , float, double double , char whar_t , , bool , true false. wchar_t , .
++ void. , , , - - , .
1.5.
. . , , . , , , , , , . , , , .
- , . , , , . , , , , . , .
. , , , , , . auto , , . register , . , , auto. extern , ( extern) . static . , static , , . .
|
|
1.6.
, . , . .
bool. , true, 1, false 0, , 0, true, false. char. , ASCII , char, ASCII .
, const .
, , , . const_cast, static_cast, reinterpret_cast dynamic_cast. , , , , , ++. const_cast . static_cast , . , static_cast. reinterpret_cast static_cast, , , , , . dynamic_cast , .
1.2. static_cast.
#include <iostream>
using std::cout;
int main (void)
{
float z;
z = (10 - 2) / 3;
cout << z << "\n";
z = static_cast<float>(10 - 2) / 3;
cout << z << "\n";
return 0;
}
1.7.
. . . 0, . , , , Ż . 3.5e2 350.0. "", ''. , , . \n. ", ' \ , \. , \ , ASCII : \xHH, HH .
|
|
1.3. .
\a | \'' | ||
\b | \' | ||
\n | \\ | ||
\r | \xHH | ASCII HH | |
\t |
, . long L l, unsigned U u, float F f.
, - , const. . #define, ++, , , .
enum . . , , ..