:
# include < iostream > usingnamespace std; int main (){ cout<<"Hello, world!"<<endl; return 0; }
#include ( ) . #include<iostream>, .
usingnamespacestd; , std. , intmain() {} .
cout<< "Hello, world!" <<endl; Hello, world .
cout . (<<). , . . , . endl .
- , , . , . return 0 , .
.
(. ) | (. ) | |
Execute Compile | F9 | |
Execute Run | F10 | |
Execute Compile & Run | F11 |
C++
, . . , - .
, , , , , .
++ . , , , .
. C++, .
() | ||||
bool | 1 | 0.. 255 | ||
() | ||||
char | 1 | 0.. 255 | ||
| ||||
short | 2 | -32 768.. 32 767 | ||
int | 4 | -2 147 483 648..2 147 483 647 | ||
long long | 8 | -9 223 372 036 854 775 808.. 9 223 372 036 854 775 807 | ||
| ||||
float | 4 | -2 147 483 648.0.. 2 147 483 647.0 | ||
double | 8 | -9 223 372 036 854 775 808.0.. 9 223 372 036 854 775 807.0 |
, , , () . bool, Bool . , , ++ ( ). , .
C++ : , .
int a; // a .
float b; // b .
double c = 14.2; // double.
char d = 's'; // char.
bool k = true; // k.
, /* */ ( ) // ( ).
, Pascal. ! . Apple apple .
( ):
= .
intmain (), .
, C++ (=) . ==.
. , a = 10 a 10.
C++
-, , :
# include <iostream> usingnamespace std; int main (){ int a, b; // a b . cout<<" : "; cin>> a; // a - . cout<<" : "; cin>> b; int c = a + b; // c . cout<<" = "<< c; // . return 0; }
, . , . , . :
1. , .
2. (+,−, *, /, %, =, <<, >>) .
3. (−5 ).
4. ( ) , .
|
|
5. .
6. A B, , , , (a b ).
:
, !!!
(/) :
: s=float(n1)/n2.
: s=1.0*n1/n2.