Results 1 to 5 of 5

Thread: ?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered 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]);
    ( ) . , .

  2. #2
    Jedem das Seine Glimmer's Avatar
    Join Date: Jun:2004
    Location:
    Posts: 1,136
    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

  3. #3
    Registered User
    Join Date: Aug:2012
    Location:
    Posts: 297
    , - , , , . . ""? . .

  4. #4
    Jedem das Seine Glimmer's Avatar
    Join Date: Jun:2004
    Location:
    Posts: 1,136
    "" , " ". 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

  5. #5
    Registered 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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Copyright © 1999-2011 . .
iskamPC.com | mobility.BG | Bloody's Techblog | | 3D Vision Blog |