Hi Vincent,
semicolon at the end of the "for" it is the only instruction that belongs
to the "for", that is to say, is the only instruction that is executed
within the "for". The instructions that are between { and } form a block,
which is a valid construction in C/C++. so that the instructions between =
{
and } are executed like part of the "for", you must delete the semicolon
at the end of the "for".
for(i=3D1;i<=3D5;i++)
{
theta2 =3D theta2 + 30.0;
if(theta2 >=3D 90.0);
}
what is the intention of this if(theta2 >=3D 90.0); ?
nothing happend, true or false nothing happend.
Greetings.
> From: Vincent Ogwuagwu <ovo...@ya...>
> To: dev...@li...
> Subject: [Dev-C++] Looping Problem
>
> Please wrote a program that does a large number of
> calculations within a loop for each value of a real
> number that is used for the loop. However, when I
> compiled and ran the program, it only recognized the
> first value of the loop, while in the actual sense it
> is supposed to calculate for three values of the real
> number. Could someone let me know how to design the
> loop to recognize the other values. The loop is as
> shown below:
>
>
> for(i=3D1;i<=3D5;i++);
>
> {
>
> =93
> =93
> theta2 =3D theta2 + 30.0;
> if(theta2 >=3D 90.0);
> }
>
> The output (Print) statement is also within the loop.
>
> Thank you.
>
> Vincent.
>
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Web Hosting - establish your business online
> http://webhosting.yahoo.com
>
--=20
Carlos Ch=E1vez
AG Software, S.A.
776-8344
267-3007
--=20
Carlos Ch=E1vez
AG Software, S.A.
776-8344
267-3007
|