Вы находитесь на странице: 1из 8

Begin 2 ���� ������� �������� a. ����� ��� ������� S = a2.

#include <iostream>
#include <cmath>

using namespace std;

int main() {
int a,s;
cout<<"a:"<<endl;
cin>>a;
s=pow(a,2);
cout<<s<<endl;
return 0;
}
--------------------------------
Begin 3 ���� ������� ������������� a � b. ����� ��� ������� S = a�b �
�������� P = 2�(a + b).

#include <iostream>
#include <cmath>

using namespace std;

int main()
{
int a,b,P,S;
cout<<"a:";
cin>>a;
cout<<"b:";
cin>>b;
S=a*b;
P=2*(a+b);
cout<<"S:"<<S<<endl;
cout<<"P:"<<P<<endl;
return 0;

-------------------------------
Begin 4 ��� ������� ���������� d. ����� �� ����� L = ?�d. � �������� ������� ?
������������ 3.14.

#include <iostream>
#include <cmath>

using namespace std;

int main() {
double d,L;
cout<<"d:";
cin>>d;
L=d*3.14;
cout<<"L:"<<L<<endl;
return 0;
}
--------------------------------
Begin 5 ���� ����� ����� ���� a. ����� ����� ���� V = a3 � ������� ���
����������� S = 6�a2.

#include <iostream>
#include <cmath>

using namespace std;

int main()
{
int a,V,S;
cout<<"a:";
cin>>a;
V=pow(a,3);
S=6*pow(a,2);
cout<<"S:"<<S<<endl;
cout<<"V:"<<V<<endl;
return 0;
}
-------------------------------------
Begin 7 ����� ����� ���������� L � ������� ����� S ��������� ������� R:
L = 2�?�R, S = ?�R2. � �������� ������� ? ������������ 3.14.

#include <iostream>
#include <cmath>

using namespace std;

int main()
{
double l,r,s;
cout<<"r:";
cin>>r;
l=2*3.14*r;
s=3.14*pow(r,2);
cout<<"l:"<<l<<endl;
cout<<"s:"<<s<<endl;
return 0;
}
-------------------------------------
Begin 8 ���� ��� ����� a � b. ����� �� ������� ��������������: (a + b)/2.

#include <iostream>
#include <cmath>

using namespace std;

int main()
{
double a,b;
cout<<"a:";
cin>>a;
cout<<"b:";
cin>>b;
(a+b)/2;
cout<<" "<<(a+b)/2<<endl;
return 0;
}
-----------------------------
Begin 9 ���� ��� ��������������� ����� a � b. ����� �� ������� ��������-
������, �� ���� ���������� ������ �� �� �����������: va�b.

#include <iostream>
#include <cmath>

using namespace std;

int main()
{
int a,b;
cout<<"a:";
cin>>a;
cout<<"b:";
cin>>b;�
sqrt(a*b);
if (a>0 && b>0) {
sqrt(a*b);
cout<<"answer:"<<sqrt(a*b)<<endl;
}
else {
cout<<"menche 0"<<endl;
}
return 0;

}
------------------------------------------
Begin 11 ���� ��� ��������� �����. ����� �����, ��������, ������������ � �������
�� �������.

#include <iostream>
#include <math.h>

using namespace std;

int main()
{
int a,b,c;
double d,e,f;
cout<<"Enter a:";
cin>>a;
cout<<"Enter b:";
cin>>b;

c=abs(a+b);
d=abs(a-b);
e=abs(a*b);
f=abs(a/b);
cout<<"Sum is:"<<c<<endl;
cout<<"Dif is:"<<d<<endl;
cout<<"Mult is:"<<e<<endl;
cout<<"Div is:"<<f<<endl;
return 0;
}

-----------------------------------------------
Begin 13 ���� ��� ����� � ����� ������� � ��������� R1 � R2 (R1 > R2).
����� ������� ���� ������ S1 � S2, � ����� ������� S3 ������, ������� ������
�������� ����� R1, � ���������� ������ ����� R2:
S1 = ?�(R1)2, S2 = ?�(R2)2, S3 = S1 ? S2. � �������� ������� ? ������������ 3.14.

#include <iostream>
#include <math.h>

using namespace std;

int main()
{
double R1,R2,S1,S2,S3;
cout<<"R1:";
cin>>R1;
cout<<"R2:";
cin>>R2;
S1=3.14*pow(R1,2);
S2=3.14*pow(R2,2);
S3=S1-S2;
if (R1>R2) {
S1=3.14*pow(R1,2);
S2=3.14*pow(R2,2);
S3=S1-S2;
cout<<"S1:"<<S1<<endl;
cout<<"S2:"<<S2<<endl;
cout<<"S3:"<<S3<<endl;
}
else {
cout<<"R2 must not be greater than R1!"<<endl;
}

return 0;

----------------------------------------------
Begin 16 ����� ��������� ����� ���� ������� � ��������� ����������- �� x1 � x2 ��
�������� ���: |x2 ? x1|.

#include <iostream>
#include <math.h>

using namespace std;

int main()
{
float X1,X2,a;
cout<<"X1:";
cin>>X1;
cout<<"X2:";
cin>>X2;
a=fabs(X2-X1);
cout<<"distance between two points:"<<a<<endl;

return 0;

----------------------------------------------
Begin 20 ����� ��������� ����� ���� ������� � ��������� ������������ (x1, y1) �
(x2, y2) �� ���������. ��������� ��������� �� �������
??(x2 ? x1)2 + (y2 ? y1)2.

#include <iostream>
#include <math.h>

using namespace std;

int main()
{
float x1,x2,y1,y2,ab;
cout<<"X1:";
cin>>x1;
cout<<"X2:";
cin>>x2;
cout<<"Y1:";
cin>>y1;
cout<<"Y2:";
cin>>y2;
ab=sqrt(pow((x2-x1),2)+pow((x2-x1),2));
cout<<"distance between two points:"<<ab<<endl;

return 0;

----------------
Begin 22 ������� ������� ���������� ���������� A � B � ������� �����
������� A � B.

#include <iostream>
#include <cmath>

using namespace std;


int main()
{
int a,b,c;
cout<<"A:";
cin>>a;
cout<<"B:";
cin>>b;
c=a;
a=b;
b=c;
cout<<a<<" "<<b;
return 0;
}
-------------
Begin 27 ���� ����� A. ��������� A8, �������� �������������� �������-
�� � ��� �������� ��������. �� ����� ��������������� �������� A2,
A4, A8. ������� ��� ��������� ������� ����� A.

#include <iostream>
#include <cmath>

using namespace std;


int main()
{
int a,b,c,d;
cout<<"A:";
cin>>a;
b=pow(a,2);
c=pow(a,4);
d=pow(a,8);
cout<<"A^2:"<<b<<endl;
cout<<"A^4:"<<c<<endl;
cout<<"A^8:"<<d<<endl;

return 0;

}
---------------
Begin 32 ���� �������� ����������� T � �������� ������. ���������� ���-
����� ���� �� ����������� � �������� ����������. ����������� �� ����- �� TC �
����������� �� ���������� TF ������ �������� ��������- ����:
TC = (TF ? 32)�5/9.

#include <iostream>
#include <cmath>

using namespace std;


int main()
{
double tc,tf;
cout<<"Tc:";
cin>>tc;
tf=tc*(9.0/5.0)+32;
cout<<"Tf:"<<tf<<endl;

return 0;

}
--------------
Begin 37 �������� ������� ��������� V1 ��/�, ������� � V2 ��/�, ������- ��� �����
���� S ��. ���������� ��������� ����� ���� ����� T �����, ���� ����������
������������� ������� ��������� ���� �����. ������ ��������� ����� ����� ��������
���������� �������� � ������ ����, ������������ �����������; ����� ���� = ���� �
�������� ��������.

#include <iostream>
#include <cmath>

using namespace std;


int main()
{
double v1,v2,s,s2,t;
cout<<"v1:";
cin>>v1;
cout<<"v2:";
cin>>v2;
cout<<"s:";
cin>>s;
cout<<"t:";
cin>>t;
s2=abs(s - (v1 + v2) * t);
cout<<"s2:"<<s2<<endl;
return 0;
}

-----------------
Begin 40 ����� ������� ������� �������� ��������� ���� A1�x + B1�y = C1,
A2�x + B2�y = C2,
�������� ������ �������������� A1, B1, C1, A2, B2, C2, ���� ��������, ��� �����
������� ����� ������������ �������. �������������� ���- ������
x = (C1�B2 ? C2�B1)/D, y = (A1�C2 ? A2�C1)/D, ��� D = A1�B2 ? A2�B1.
m,,m,m,m

#include <iostream>
#include <string>

using namespace std;

int main()
{
int a1,b1,c1,a2,b2,c2,d,x,y;
cout<<"Input A1:";
cin>>a1;
cout<<"Input B1:";
cin>>b1;
cout<<"Input C1:";
cin>>c1;
cout<<"Input A2:";
cin>>a2;
cout<<"Input B2:";
cin>>b2;cout<<"Input C2:";
cin>>c2;
d=(a1*b2)-(a2*b1);
x=((c1*b2)-(c2*b1))/d;
y=((a1*c2)-(a2*c1))/d;

cout<<"x="<<x<<"y="<<y;
return 0;
}

Вам также может понравиться