Results 1 to 5 of 5
Thread: ?
Hybrid View
-
12th December 2013 00:56 #1Registered User
Join Date: Aug:2012
Location:
Posts: 297
?
, , . :
Code:#include <iostream> #include <cmath> using namespace std; void func(int n) { cout << n; } struct point { double x,y; void read(); }; double distance(point a, point b) { return sqrt( (a.x - b.x)*(a.x - b.x) + (a.y - b.y)*(a.y - b.y) ) ; } void point::read() { double n; cout << "Enter x: " ; cin >> x; cout << "Enter y: " ; cin >> y; } int main() { int n; point tochka[30]; cout << " Enter n (n is the number of points): "; cin >> n; for(int i = 0 ; i <= n-1 ; i++) { tochka[i].read(); } for(int i = 0 ; i <= n-2 ; i++) for( int j = i+1 ; j <= n-1 ; j++) { cout << " The distance between " << i << "th and " << j << "th points is: " ; cout << distance(tochka[i],tochka[j]); } system("pause"); return 0; }
. ( ) . , .Code:cout << distance(tochka[i],tochka[j]);
-
12th December 2013 02:13 #2
std::distance() STL. . bad manner using namespace std; "". , , "".
DX58SO | x5670@4.2 | Megahalems | 3x4 EBJ40EG8BFWB-JS-F@1400 MHz | MSI GTX 970 1488/8000 | THNSNH256GBST + 3 x WD1600HLHX RAID 0 | X-Fi Titanium | P1-1250-BEFX
The big trouble with dumb bastards is that they are too dumb to believe there is such a thing as being smart. Kurt Vonnegut
-
12th December 2013 13:27 #3Registered User
Join Date: Aug:2012
Location:
Posts: 297
, - , , , . . ""? . .
-
12th December 2013 14:56 #4
"" , " ". std::cout , using std::cout;, std namespace. , hex, left, plus count distance.
DX58SO | x5670@4.2 | Megahalems | 3x4 EBJ40EG8BFWB-JS-F@1400 MHz | MSI GTX 970 1488/8000 | THNSNH256GBST + 3 x WD1600HLHX RAID 0 | X-Fi Titanium | P1-1250-BEFX
The big trouble with dumb bastards is that they are too dumb to believe there is such a thing as being smart. Kurt Vonnegut
-
12th December 2013 15:40 #5Registered User
Join Date: Aug:2012
Location:
Posts: 297
court, . , . . hex , left .
.. . . - "s" . . . : :
:
1 2 3 4 5
6 7 8 9 10
11 12 13 14 15
:
5
10 4
3 9 15
14 8 2
1 7 13
12 6
11
.. -.
- , .
, :
1) :
5
10 4
3 9 15
min , min= min {m,n} , A(mxn)
2) " " .. 14 8 2
3) (.. " " )
- alternative . , , alternative true , false . .., alternative true , false .
-: m > n , alternative true , alternative e false.
, m <= n
" " .
, :, ( ), , - .
" " , , , , - , .
, ( ).
.Last edited by DuMBo0o; 12th December 2013 at 16:12.




Reply With Quote
Lenovo ThinkPad 15 IdeaPad 15
5th May 2023, 22:16 in