1. . C++ - . - 볭 , . istream.h , ostream.h , iostream.h .
ϳ - . -, , , , (. ). ϳ - (n), (cout), (rr) (clog).
(>>) (<<) . , . , , , (. 7).
2. . : , = 3.1, . , (). >> iostream. h (istream.h) :
n >> <>;
ij . . ( , ). . (, ).
, , , ">>", :
n >> < 1> >> < 2> >>... >> <N>;
1 3. , , :
int a, b, ; n >> ; cin >> b; cin >> ;
ϳ
3 J ( Enter)
4 J
5 J
: = 3, b = 4, = 5.
. 3 4 5 J. :
n >> >> b >> ;.
( ) , , . , .
, , . . - , . , 1 " " ", b, =" , :
|
|
cout << "B "; n >> >> b >> ;
3. . cout <<, iostream.h (ostream.h):
cout << < 1> << < 2> <<... << < N>;
, . cout .
ij . , . Window →User screen Alt+F5.
. .
( ) , , :
cout << " = " << ;
cout << " = " << s;
= 12 = 6
, . , , .
4. . , . "\" . , , , , : , . . 5.
5.
\a, \7 | |
\b | ( ) |
\f | |
\n | |
\r | |
\t | |
\v | |
\\ | |
\ | |
\ | |
\? |
.. .
cout << "! \a\n "; cout << " \"\" \n";
cout << " ";
!
""
, C++ (, \u), ( ) , ( u).
1. \n endl . , :
|
|
cout << "f=" << f << "\n";
cout << "f=" << f << endl;.
2. ( float) . , cout.precision(n) ' iomanip.h
cout << setiosflags(ios::scientific);.
1 ( , ). (1; 1), (2; 2) (-1; 2). r.
#include <iostream.h> // 2
#include <math.h> //
#include <conio.h>
void main()
{
clrscr(); //
float x1, x2, , y1, y2, ; //
cout << " ";
n >> 1 >> :
cout << " ";
n >> 2 >> 2;
cout << " ";
n >> >> ;
float a, b, , , , mb, p, s, r; //
II
= sqrt(pow((x3 - 2), 2) + pow((y3 - 2), 2));
b = sqrt(pow((x1 - ), 2) + pow((y1 - ), 2));
= sqrt(pow((x1 - 2), 2) + pow((y1 - 2), 2));
= (1 + ) / 2; //
= (1 + ) / 2; // b
mb = sqrt(pow((x - 2), 2) + pow((y - 2), 2)); // mb
= ( + b + c) / 2; //
s = sqrt(p * ( - ) * ( - b) * ( )); //
= * b * / (4 * s); //
cout << "mb = " << mb << "\n"; //
cout << "r = " << r "\n"; //
getch(); //
}
ϳ clrscr() ( ),
mb = 2.061553 = 1.581139
2 ' conio.h, clrscr() getch(), , .
. ' :
d (x1, 1), (2, 2):
:
:
:
:
, ,
:
, ,
:
:
a,b, - , α, β, γ .
5. - MS DOS. exe- , . ,
< -> < < >
1. 2 tyrik.exe, dani.txt . dani.txt :
tyrik.exe < dani.txt
,
< -> > < >
tyrik.exe > res1.txt. tyrik.exe resl.txt.
, :
< -> < < > > < >
|
|
file1 file2, ' :
file1 I file2
1. 1 4. "", . . .
2. ' 2 "". clrscr() getch(). :
) ;
) Myres.dat.
3. , . 2, .