void
MyClass::myMethod(void)
{
:
}
.
6.2
84.
.
C++ .
.
.
for .
a = (b + c) * d; // : a=(b+c)*d
while (true) // : while(true)
{
...
doSomething(a, b, c, d); // : doSomething(a,b,c,d);
case 100: // : case 100:
for (i = 0; i < 10; i++) { // : for(i=0;i<10;i++){
...
. . C++. .
85. , .
doSomething (currentFile);
. . , (doSomething()).
. : doSomething(currentFile);. ; , (doSomething(currentFile);).
.
Matrix4x4 matrix = new Matrix4x4();
double cosAngle = Math.cos(angle);
double sinAngle = Math.sin(angle);
matrix.setElement(1, 1, cosAngle);
matrix.setElement(1, 2, sinAngle);
matrix.setElement(2, 1, -sinAngle);
matrix.setElement(2, 2, cosAngle);
multiply(matrix);
.
.
.
.
AsciiFile* file;
int nPoints;
float x, y;
. .
, .
if (a == lowValue) compueSomething();
else if (a == mediumValue) computeSomethingElse();
else if (a == highValue) computeSomethingElseYet();
value = (potential * oilDensity) / constant1 +
(depth * waterDensity) / constant2 +
(zCoordinateValue * gasDensity) / constant3;
minPosition = computeDistance(min, x, y, z);
averagePosition = computeDistance(average, x, y, z);
switch (value) {
case PHASE_OIL: strcpy(phase, "Oil"); break;
case PHASE_WATER: strcpy(phase, "Water"); break;
case PHASE_GAS: strcpy(phase, "Gas"); break;
}
, , .
6.3
|
|
90. , , , !
, .
.
.
92. // , .
// ,
// .
, /* */ .
// , .
, , .
while (true) { // : while (true) {
// Do something // Do something
something(); something();
} }
, , .