- .
- .
, . .
:
()
: ().
-
: ()
().
()
: .
: .
2.3.
, , { }.
{
_1;
...
_n
}
.
2.4.
, , .
, -, :
if () _1;
else _2;
. , .. true, _1, ( , .. false) _2.
, , :
:
if () ;
else.
, , .
- , .
2.5.
2. , b ax2+bx+c=0. .
: a, b, c.
: 1, 2.
#include <stdio.h>
#include <math.h>
void main()
{
float a,b,c,d,x1,x2;
printf("\n vvedite a \n");
scanf("%f",&a);
printf("\n vvedite b \n");
scanf("%f",&b);
printf("\n vvedite c \n");
scanf("%f",&c);
d=b*b-4*a*c;
if (d<0) printf("reshenij net \n");
else
{
x1=(-b+sqrt(d))/(2*a);
x2=(-b-sqrt(d))/2/a;
printf("x1=%f \n", x1);
printf("x2=%f \n", x2);
}
}
2. ax4+bx2+c=0 (y=x2).
: a,b,c.
: 1, 2, 3, 4.
:
1. d.
2. d ³ 0, y1 y2, .
3. y1, y2 < 0, .
4. y1, y2 ³0, .
|
|
5. 3) 4) , y1. y1³0, . y2³0, . .
#include <iostream.h>
#include <math.h>
void main()
{
float a,b,c,d,y1,y2,x1,x2,x3,x4;
cout<<"\n a="; cin>>a;
cout<<"\n b="; cin>>b;
cout<<"\n c="; cin>>c;
d=b*b-4*a*c;
if (d<0) cout<<"resh.net"<<endl;
else
{
y1=(-b+sqrt(d))/2/a;
y2=(-b-sqrt(d))/2/a;
if (y1<0 && y2<0)
cout<<"resh.net"<<endl;
else
if (y1>=0 && y2>=0)
{
x1=sqrt(y1); x2=-x1;
x3=sqrt(y2); x4=-sqrt(y2);
cout<<"x1="<<x1<<endl;
cout<<"x2="<<x2<<endl;
cout<<"x3="<<x3<<endl;
cout<<"x4="<<x4<<endl;
}
else
if (y1>=0)
{
x1=sqrt(y1); x2=-x1;
cout<<"x1="<<x1<<endl;
cout<<"x2="<<x2<<endl;
}
else
{
x1=sqrt(y2); x2=-x1;
cout<<"x1="<<x1<<endl;
cout<<"x2="<<x2<<endl;
}
}
}
3. :
(1)
a (1) :
(2)
, , .
(2) (3)
, (3)
, .
(3) :
- | |
D≥0 | |
D<0 |
(3) :
(4)
.
(3) 3 :
, (5)
, .
(3) (4) (5) (1):
[1] , .
[2]
[3] ,