:
( ).
i (i=1).
():
i ():
( i=f(i) );
(i=i+1);
. 3;
i (i>7), .
. 5.8.
:
( ).
i (i=1).
( i = f(i) ).
(i=i+1).
():
i (), . 3;
i (i>7), .
. 5.9.
:
( ).
:
i (i=1).
():
i , ( i = f(i) ), (i=i+1) . 2.2;
i (i>7), .
. 5.10.
, , .
/++, , . /++ .
/++ .
/++ .
. , /++ . () :
|
|
;
.
5.2.1. /++
. . .
. . ( ). .
, X(7) X(7), X(10), X(15), X 10 15 .
, .
, Y(m) m (50, 100, 150) .
. () . ( ) .
:
[];
, ;
( );
, ;
[ ] .
, D 16 :
int d[16]; int d[20];
30 :
float a[30];
Y(m) :
float y[50]; float y[100]; float y[150];
x, y, z, T(120) S(70) :
float x, y, z, t[120], s[70]; float y, t[120], x, s[70], z;
.. .
5.2.2. /++
. /++ .
( ) . () .
ü ! /++ - 0, 1. /++ . , ( ) .
:
0 | 1 | 2 | i-1 | n-2 | n-1 | ||||||||
1- | 2- | 3- | .. | .. | .. | i- | .. | .. | .. | n-1- | n- | ||
:
|
|
1 ;
2 ;
4 ;
8 .
:
[]
, ;
, , ;
[ ] .
, D(16) d[0], d[1], d[i], d[14] d[15].
, . , d[i+2] d[j*5+3]. () .
D .
. .
&. , d[0] &d[0], d[i] &d[i], .. , &d[0].
/++ . , c º &c[0], d º &d[0].
+
.
, i- (&c[i]) c + i.
, .
5.2.
: , i (7) (7). . 5.3.
5.3
c1 | c2 | ... | c6 | c7 | i | ci | i | ||
c[0] | c[1] | ... | c[5] | c[6] | pro | p[i] | c[i] | i |
:
c[0] | c[1] | c[2] | c[3] | c[4] | c[5] | c[6] | ||
c1 | c2 | c3 | c4 | c5 | c6 | c7 | ||
4 | 4 | 4 | 4 | 4 | 4 | 4 |
(7) .
.
ü ! /++ .
:
/* 5.2. . * /
/* . 033 ..*/
#include <stdio.h> /* */
#include <math.h> /* */
main() /* */
{
float c[7], p[7], pro; /* */
/* */
int i; /* */
scanf("%3f%4f%4f%4f%4f%4f%4f%4f",&pro,&c[0],&c[1],
&c[2],&c[3],&c[4],&c[5],&c[6]); /* */
|
|
printf(" pro=%8.2f\n\n", pro); /* pro */
i=0; /* */
while(i < 7) /* */
{
p[ i ]=(c[ i ]*pro)/100.;/* */
printf(" %8.2f %7.2f\n", c[ i ], p[ i ]);
i=i+1; /* */
}
}
25.492.503.948.738.892.320.250. .
5.4.
:
/* 5.2. . * /
/* . 033 . */
#include <stdio.h> /* */
#include <math.h> /* */
main() /* */
{
float c[7], p[7], pro; /* */
/* */
int i; /* */
scanf("%3f%4f%4f%4f%4f%4f%4f%4f",&pro,&c[0],&c[1],
&c[2],&c[3],&c[4],&c[5],&c[6]); /* */
printf(" pro=%8.2f\n\n", pro); /* pro */
i=0; /* */
do /* */
{
p[ i ]=(c[ i ]*pro)/100.;/* */
printf(" %8.2f %7.2f\n", c[ i ], p[ i ]);
i=i+1; /* */
}while(i < 7); /* */
}
25.492.503.948.738.892.320.250. .
5.5.
:
/* 5.2. * /
/* . 033 . */
#include <stdio.h> /* */
#include <math.h> /* */
#include <stdlib.h>
main() /* */
{
float c[7], p[7], pro; /* */
int i; /* */
scanf("%3f%4f%4f%4f%4f%4f%4f%4f",&pro,&c[0],&c[1],
&c[2],&c[3],&c[4],&c[5],&c[6]); /* */
printf(" pro=%8.2f\n\n", pro);/* pro */
for(i=0; i < 7; i=i+1) /* */
{
p[i]=(c[i]*pro)/100.;/* */
printf(" %8.2f %7.2f\n", c[ i ], p[ i ]);
}
}
25.492.503.948.738.892.320.250. .
5.6.
. .
, . , . , . , .
.
, , .. .
() .
( , , ).
.
. ( ).
|
|
( , , . .).
?
, , ?
?
?
, ?
while?
, ?
do... while?
, ?
for?
?
?
, ?
?
?
?
/++?
?