&, |, ^, ~, <<, >>.
.
||, &&,!.
true () false (). ++ 0, ¹ 0.
:
>, >=, <, <=, ==,!=.
true () false ().
?:
:
? 1: 2;
. ( 0), 1, 2.
,
y=x<0? x: x;
y .
++ :
() ;
,
x=5;
y=x/2;
z=(float) x/2;
y 2 ( ), z = 2.5.
, :
sizeof ()
sizeof
C++ :
abs(x) | |
fabs(x) | |
sin(x) | |
cos(x) | |
tan(x) | |
atan(x) | |
exp(x) | , ex |
log(x) | (x>0) |
log10(x) | (x>0) |
sqrt(x) | (x≥0) |
pow(x,y) | x y |
pow(x,y), y. .
, , y . , y k/m. m , , , . , m ,
z=pow(fabs(x),y).
++ , .
main.
:
_ _ ()
{
1;
2;
N;
}
,
_ , ( , void),
|
|
_ , ,
( ),
1, 2,, N , , .
++ , .
, :
#include <_>
, .h. .
- , , , .
, math.h.
++ :
. .
_ main()
{
}
_ 1(1)
{
1;
}
_ 2(2)
{
2;
}
..................
_ N(N)
{
N;
}
- ++ - , ++. ++ , . - , .
-
printf( ,
)
, , .
scanf( ,
)
, , .
, .
, % :
% .
, , .
, - ,
#include <stdio.h>
stdio.h -.
1. a, b, c , S P .
: a, b, c.
: S, P.
: ,
r .
// 2.1.
//
#include "stdafx.h"
#include <stdio.h>
#include <math.h>
int main()
{
float a,b,c,S,r;
printf("a=");
scanf("%f",&a);
printf("b=");
scanf("%f",&b);
printf("c=");
scanf("%f",&c);
r=(a+b+c)/2;
S=sqrt(r*(r-a)*(r-b)*(r-c));
printf("S=%5.2f \t",S);
printf("p=%5.2f \n", 2*r);
return 0;
}
// 2.1.
//
|
|
#include "stdafx.h"
#include <stdio.h>
#include <math.h>
int main()
{
float a,b,c,S,r;
printf("Vvedite a,b,c \n");
scanf("%f%f%f",&a,&b,&c);
r=(a+b+c)/2;
S=sqrt(r*(r-a)*(r-b)*(r-c));
printf("S=%5.2f \t
p=%5.2f \n",
S,2*r);
return 0;
}
-
-.
- iostream.h.
#include <iostream.h>
-[3]
cin ,
cout ,
<<,
>>.
cin >> .
, i ,
cin>>i;
, i , .
,
cin>>x>>y>>z;.
cout << .
.
\t -
\n .
cout<<i; i.
cout<<x<<\t<<y;
x y .
2. r, h R , . V, m S .
: r, h, R.
: S, V, m.
, S =2 pR, V =p R 2 h m = rV :
#include "stdafx.h"
#include <iostream.h>
//.
#define pi 3.14159
int main()
{
double R,h,r,S,V,m;
cout<<"R=";
cin>>R;
cout<<"h=";
cin>>h;
cout<<"r=";
cin>>r;
S=2*pi*R;
V=pi*R*R*h;
m=r*V;
cout<<"S="<<S;
cout<<"\n V="<<V;
cout<<"\n m="<<m;
}
:
;
;
;
;
;
.
, (, ).
.
:
;
-;