.


:




:

































 

 

 

 





1

 

++

 

:

 

1. Visual C++;

2. .

3. ++;

- ;

- ;

4. :

- ;

- ;

- ;

- ;

- .

5. Microsoft Visual C++ 5.0.

 

:

- , IBM PC.

 

:

- Windows;

- Microsoft Visual C++ 5.0 ( Microsoft Visual C++ 5.0).

 

 

1.1. Microsoft Visual C++ 5.0.

1.2. Microsoft Visual C++ 5.0.

1.3. Microsoft Visual C++ 5.0.

1.4. 1, 2, 3 .

1.5. .

 

 

2.1. Microsoft Visual C++ 5.0.

2.2. *.cpp .

2.3. 1, 2, 3 .

2.4. ( ). .

2.5. Microsoft Visual C++ 5.0 .

 

3.1. .

3.2. .

3.3. .

3.4. .

3.5. .

3.6. .

 

4.1. Microsoft Visual C++ 5.0.

 

Microsoft Visual C++ 5.0 - Microsoft Visual C++ 5.0 - Microsoft Visual C++ 5.0.

C++ , :

Ø Visual C++ ( Microsoft Visual C++ 5.0. Microsoft Visual C++ 5.0.);

Ø 'New' 'File'. , 'New' 'Projects'. 'Win32 Console Application';

Ø Location (:\students\*) Project name, , 'First' 'OK'. 'First classes';

Ø 'New', 'Files' 'C++ Source File'. File name , 'First' 'OK' 'First.cpp'.

 

.

/++, :

Ø (include, define..);

Ø ;

Ø ;

Ø ;

Ø 1;

Ø 2;

Ø main().

, , .

, . , , main. .

:

Void main(void)

{

}

main, (void). , , .

, . ( ), ( ).

main, . main , , .

main, , . exit() stdlib.

 

 

, , .

main(). . , , . main :

 

1:

// ++

#include <iostream.h>

Void main ()

{

cout << Thise is my first program\n << endl;

}

, . File Save All. () :

Ø (BuildBuild *.exe) (F7), . , , ;

Ø , (BuildExecute *.exe.) (Ctrl+F5);

Ø .

#include , , iostream.h. cout << " Thise is my first program " . 1.

 

1.

/++

   
math .
ctype
stdio /
string
stdlib ,
alloc
conio

 

<< (" ") ( , " Thise is my first program " cout). , . \, , ; , \n . , " Thise is my first program " , , main. main, .

 

 

( ) . , , .

 

2:

#include <iostream.h>

Void main()

{

int inch = 0; // inch -

cout << "inches";

cin >> inch;

cout << inch;

cout << " in = ";

cout << inch*2.54;

cout << " cm\n";

}

main() inch. >> (" ") cin.

; . << , :

cout << inch << " in = " << inch*2.54 << " cm\n";

 

 

, . C++ .

/* , */. (, ). , , /* */ .

// , , . , . . // , /* */, /* //.

 

4.6. C++

 

, , . C++ ( ):

Ø (int, short, char);

Ø (float, double, long ( ), long double ( );

Ø - Unsigned;

Ø Char .

.

 

()
char -128..127;  
unsigned char 0..255;  
int -32 768.. 32 767;  
unsigned int 0..65535;  
long -2 147 483 648..2 147 483 647;  
unsigned long 0..4 294 967 295;  
float 3.4e-38..3.4e+38;  
double 1.7e-308..1.7e+308;  
long double 3.4e-4932..3.4e+4932.  

 

C/C++ :

Int iMyVariable;

iMyVariable . char:

Char cMyChar;

, int, float, char long, C/C++ , , . C/C++ , .

3 , . 3:

#include <iostream.h>

Void main(void)

{

cout << " (unsigned)int = " << sizeof(int) << endl;

cout << " (unsigned)short = " << sizeof(short) << endl;

cout << " (unsigned)char = " << sizeof(char) << endl;

cout << " (unsigned)float = " << sizeof(float) << endl;

cout << " (unsigned)double = " << sizeof(double) << endl;

cout << " (unsigned)long = " << sizeof(long) << endl;

cout << " (unsigned)long double = " << sizeof(long double) << endl;

}

, sizeof (). , ( int 16- 32- , 1 2 ).

sizeof . , , . sizeof , , , void . , sizeof, sizeof (char) 1.

4.7.

 

, , , . . . , . , , .

, , . .

- , .

, , . , : , , ( ), .

(, ), , .

, . .

, , , .

++ , : const volatile.

, . , . const , .

volatile , . , . - .

/++ , 2.

 

2.

 

 

\b
\f
\n
\r
\t
\
\
\0
\\
\v
\a
\?
\N N
\xN N

 

: ( 13), ( 10), ( 9). , \n, \r, \t . \\

: extern, static, register, auto.

, . , :





:


: 2016-12-06; !; : 842 |


:

:

,
==> ...

1691 - | 1571 -


© 2015-2024 lektsii.org - -

: 0.033 .