.


:




:

































 

 

 

 





int getValue() // : getValue()

{

:

}


, C++ , int. , , .

69. goto.

. (, ), .

70. 0 NULL.

NULL C C++.

 

6.1


71. .

for (i = 0; i < nElements; i++)

a[i] = 0;


, . 4 , . 2, 3 4 ; 2 4 .

, 1 () 2, , 3. 2.

while (!done) {

doSomething();

done = moreToDo();

}

 

while (!done)

{

doSomething();

done = moreToDo();

}

 

while (!done)

{

doSomething();

done = moreToDo();

}


3 , .

73. :

class SomeClass: public BaseClass

{

public:

...

 

protected:

...

 

private:

...

}


, .

74. :

void someMethod()

{

...

}


, .

75. if-else :

if (condition) {

statements;

}

 

if (condition) {

statements;

}

else {

statements;

}

 

if (condition) {

statements;

}

else if (condition) {

statements;

}

else {

statements;

}


, . else , , :

if (condition) {

statements;

} else {

statements;

}


if-else . , , else.

76. for :

for (initialization; condition; update) {

statements;

}


, .

77. for :

for (initialization; condition; update)

;


, . , , .

78. while :

while (condition) {

statements;

}


, .

79. do-while :

do {

statements;

} while (condition);


, .

80. switch :

switch (condition) {

case ABC:

statements;

// "break"

 

case DEF:

statements;

break;

 

case XYZ:

statements;

break;

 

default:

statements;

break;

}


, case , . . - break, . , .

81. try-catch :

try {

statements;

}

catch (Exception& exception) {

statements;

}


, . , if-else, .

82. if-else , .

if (condition)

statement;

 

while (condition)

statement;

 

for (initialization; condition; update)

statement;


.





:


: 2015-10-20; !; : 362 |


:

:

! . .
==> ...

1907 - | 1699 -


© 2015-2024 lektsii.org - -

: 0.009 .