++, , , - . , , , - : , .
++ - . , , . ++ . "" , "" . ++ , .
, , , .
++ | |
#include "stdio.h" int i; char temp[80], buff[80];
printf (" :"); |
#include "iostream.h" int i; char buff[80];
cout << " :"; |
- ++. cin - , , cout - , . cin cout, , (), (), iostream ().
++ - - printf() scanf() , ++ , . ++ / << >>, . ( ), << >> .
cout << ;
++.
( scanf()).
,
int i;
cin >> i;
, i &. , >>:
cin >> ;
/ ++, iostream.h.
++ . . , .
.
class _
{
public:
};
?
struct _3d
{
double mod ();
double projection (_3d r);
private:
double x, y, z;
};
class _3d
{
double x, y, z;
public:
double mod ();
double projection (_3d r);
};
++ class. , , . struct , , , .
mod() projection(_3d r) _3d, . , , , . . .
double _3d::mod ()
{
return sqrt (x*x + y*y +z*z);
}
double _3d::projection (_3d r)
{
return (x*r.x + y*r.y + z*r.z) / mod();
}
...
main()
{
_3d a, b;
double dPro, dMod;
dMod = a.mod();
dPro = b.projection(a);
}
++ - .
, , , ++ , .
double power (double x) {return x*x;}, , : abs(), labs() fabs() , , , . - , (.. ), . ++ "" .
int abs (int x) { return x<0 ? -x:x; } // 1
long abs (long x) { return x<0 ? -x:x; } // 2
double abs (double x) { return x<0 ? -x:x; } // 3
main()
{
cout << " -1000" << abs(-1000) << "\n"; // 1
cout << " -1000L" << abs(-1000L) << "\n"; // 2
cout << " -1000.0" << abs(-1000.0) << "\n"; // 3
}
++ , overload. .
, " , ".
. , . . . , , . .
: .
, - , , . :
int i1, i2, i3;
long int l1, l2, l3;
double f1, f2, f3;
i1 = i2 + i3;
l1 = l2 + l3;
f1 = f2 + f3;
"+". ( , ). , , . , "+" ( ) .
. BASIC "+". , "+", , , .
++ , - , , ++ , .
. ( ) operator , . . - .
struct _3d
{
double x, y, z; //
_3d operator + (_3d);
};
_3d _3d::operator + (_3d b)
{
_3d c;
c.x = x + b.x;
c.y = y + b.y;
c.z = z + b.z;
return c;
}
(). () . - ".".
:
_3d A, B, C;
A.x = 1.0;
A.y = 1.0;
A.x = 1.0;
B = A;
C = A + B; // C = A.operator + (B); /operator +(...) A/
:
. , , , . (, ). , , , "+" , 18 "". , .
++. . , , .
, .
,
void f (int i=0, int j=1); // f (...)
...
void f (int i, int j)
{
... //
}
f (); // i 0, j 1
f (10); // i 10, j 1
f (11, 22); // i 11, j 22
j, i , . , , .
. .
. , , , , , . , , , .
10.11.2021 - 12:37: - Personalias -> WHO IS WHO - - _. 10.11.2021 - 12:36: - Conscience -> . ? - _. 10.11.2021 - 12:36: , , - Upbringing, Inlightening, Education -> ... - _. 10.11.2021 - 12:35: - Ecology -> - _. 10.11.2021 - 12:34: , - War, Politics and Science -> - _. 10.11.2021 - 12:34: , - War, Politics and Science -> . - _. 10.11.2021 - 12:34: , , - Upbringing, Inlightening, Education -> , - _. 10.11.2021 - 09:18: - New Technologies -> , 5G- - _. 10.11.2021 - 09:18: - Ecology -> - _. 10.11.2021 - 09:16: - Ecology -> - _. 10.11.2021 - 09:15: , , - Upbringing, Inlightening, Education -> - _. 10.11.2021 - 09:13: , , - Upbringing, Inlightening, Education -> - _. |