1
: .
:
1) ;
2) C++ .
:
1. 1 .
2. 1.4 , .
3. 2 , X1 Y1 TRUE, , FALSE, .
4. 2 , .
5. 3 , (float double).
6. .
7. .
15
. , ++ , 3 :
1) ;
2) ;
3) ( ).
. . .
++
C++ . ++, .
. . int, float.
1 ++ | |||
x | y | ||
x = 15 y = 2 | |||
int | int | int | 15/2=7 |
int | float | float | 15/2=7.5 |
float | int | float | 15/2=7.5 |
:
, :
: . .
. , . , 0 int int*, 0.
|
|
, . :
, , . .
1. .
2. .
3. .
4. .
5. .
1:
:
#include<iostream>
#include<conio.h>
#include<math.h>
using namespace std;
int main()
{
int m, n, k;
double x,d;
cout<<"\n n=";
cin>>n;
cout<<"\n m=";
cin>>m;
cout<<"\n x=";
cin>>x;
k=n++/(--m);
cout<<"\n n++/(--m)="<<k;
n-->n/m++?
cout<<"\n n-->n/m++: it is true ":cout<<"\n n-->n/m++:it is false ";
m<n++?
cout<<"\n m<n++: it is true ":cout<<"\n m<n++:it is false ";
d = 1+x*pow(cos(x),2)+pow(sin(x),3);
cout<<"\n d="<<d<<endl;
cout<<n<<endl;
cout<<m<<endl;
return 0;
}
:
:
n = 2
m = 3
x = 5
2:
:
#include "stdafx.h"
#include <iostream>
#include "math.h"
#include "conio.h"
using namespace std;
void main()
{
float x, y;
float r=1;
printf("%s", "Enter x \n");
scanf_s("%f",&x);
printf("%s", "Enter y \n");
scanf_s("%f",&y);
bool ok = ((x*x)+(y*y)<=(r*r)&&y<=0||(x*x)+(y*y)<=(r*r)&& x<=0 && y>=0);
if (ok){
cout<<"Tocka popadaet!"<<endl;
}else{
cout<<"Tocka Ne popadaet."<<endl;
}
system("pause");
}
:
3:
:
#include "stdafx.h"
#include <iostream>
#include <cmath>
using namespace System;
using namespace std;
void main()
{
cout <<"a = 10" << '\n';
cout <<"b = 0.01" << '\n';
float a=10;
float b=0.01;
float x,k,d,g,t,c,o;
double x2,k2,d2,g2,t2,c2,o2;
x=(a-b)*(a-b)*(a-b)*(a-b);
k=a*a*a*a;
c=a*a*a;
d=b*b;
g=b*b*b;
o=b*b*b*b;
t=a*a;
x2=(a+b)*(a+b)*(a+b);
k2=a*a*a*a;
c2=a*a*a;
d2=b*b;
g2=b*b*b;
o2=b*b*b*b;
t2=a*a;
float chislit = x - (k-4*c*b);
float znamen = 6*t*d-4*a*g+o;
float result =chislit/znamen;
double chislit2 = x2 - (k2-4*c2*b);
double znamen2 = 6*t2*d2-4*a*g2+o2;
double result2 =chislit2/znamen2;
cout<<"znamen="<<znamen<<endl;
cout<<"chislit="<<chislit<<endl;
cout<<"result="<<result<<endl;
cout<<"znamen2="<<znamen2<<endl;
cout<<"chislit2="<<chislit2<<endl;
cout<<"result2="<<result2<<endl;
system("pause");
}
:
: C++ ..
|
|