Results 1 to 12 of 12

Thread:

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User BeTaTesTeR's Avatar
    Join Date: Nov:2006
    Location:
    Posts: 6,693

    ,

    C++, 8 , V - . , - V, , . -. . !

    Code:
    #include <iostream.h>
    
    
    void main () {   //  
    
    	double L [8];
    	double W [8];
    	double H [8];
    	double V [8];
    	double t;
    	int p=0,u=0;
    
     for(int i = 0; i < 8; i++)         //  
    
    	{
    		cout<<"\n Vuvedete L W H za opakovka "<<i+1<<"\n";
    		do
    		{
    			cout<<" L = ";
    			cin>>L[i];
     		if(L[i] <= 0)           //      -    
    
    				cout<<"\n Vuveli ste nekorektna stoinost! Opitaite otnovo:\n";
    		}while(L[i] <= 0);
    
    			do
    		{
    			cout<<" W = ";
    			cin>>W[i];
    			if(W[i] <= 0)
    				cout<<"\n Vuveli ste nekorektna stoinost! Opitaite otnovo:\n";
    		} while(W[i] <= 0);
    
    		do
    		{
    			cout<<" H = ";
    			cin>>H[i];
    			if(H[i] <= 0)
    				cout<<"\n Vuveli ste nekorektna stoinost! Opitaite otnovo:\n";
    		} while(H[i] <= 0);
    		
    	
    	}
    
     for(i = 0; i < 8; i++)   //       
    	{
    		cout<<"\n\n Vuvedenite stoinosti:  L W H za opakovka "<<i+1<<" sa: "<<"\n";
    		cout<<" L = "<< L[i]<<"\n";
    		cout<<" W = "<< W[i]<<"\n";
    		cout<<" H = "<< H[i]<<"\n";
    		V[i] = L[i]*W[i]*H[i];
    		cout<<" V = "<<V[i]<<endl;
    		
    	}
    
     for(int j = 0; j < 8; j++)  //      - 
    	{
    
    		if(V[j] > V[j+1]){ 
                t = V[j];
                V[j] = V[j+1];
    				V[j+1] = t; 
    				
    			
    		}  
    	}
    
    	cout<< "Nai-golqmata opakovka e s obem  V= "<<t<<endl;
    
    
    }
    !

  2. #2
    Registered User vlex's Avatar
    Join Date: Jan:2008
    Location: Sofia
    Posts: 340
    j ( ). - ( public).

  3. #3
    Bombera's Avatar
    Join Date: Jul:2001
    Location: 4EVA
    Posts: 13,833
    , ( ). - "4, 8, 2" . "" , (j = 7, j + 1 = 8, V[8] e ).
    .
    , - ( , ), - , (. - ), , . , , - .

    .. , - (. , , ) - . - , - , .
    Last edited by Bombera; 7th September 2012 at 13:10.
    EVGA X299 FTW K|i9-7960X@4.7|4x8 Patriot Viper Steel 4000|GTX 1660 Ti|970 EVO 1 TB|Seasonic Focus GX-1000|Xigmatek Elysium|
    Rampage IV Extreme BE|E5-1680v2@4.7|4x4 HyperX 1866|Cougar Aqua 240|GTX 1050 Ti|970 EVO 1/4 TB|CM 850 SilentPro|HAF-X|

  4. #4
    Registered User BeTaTesTeR's Avatar
    Join Date: Nov:2006
    Location:
    Posts: 6,693
    " j ", ? , , . . .
    , ?

    : , . , :

    Code:
    for(int j = 0; j < 8; j++)  
    	{
    
    		if(t < V[j]){ 
                t = V[j];
                p=j; 
    				
    			}  
    	}
    
    	cout<< "Nai-golqmata opakovka e nomer:"<< p+1<< "   s obem  V= "<<t<<endl;
    
    
    }
    Bombera, , , .
    !
    Last edited by BeTaTesTeR; 7th September 2012 at 13:29.
    !

  5. #5

    Join Date: Apr:2006
    Location:
    Posts: 8,666
    vector , ? , , performance

  6. #6
    Registered User
    Join Date: Aug:2008
    Location: Varna
    Posts: 291
    l, w, h.. . , . .

  7. #7
    Registered User
    Join Date: Oct:2003
    Posts: 1,860
    Quote Originally Posted by BeTaTesTeR View Post
    ... - .

  8. #8
    no brain no pain baracuda's Avatar
    Join Date: Aug:2006
    Location: Sofia
    Posts: 35,840
    . ...
    , , - ( , ) , 0 N-1 (7 ). . , , . , .
    . , .

    P.S. . . , , . ( ) - , (copy-paste) - , . , , . , , -.

  9. #9
    Registered User FuLLmaXx's Avatar
    Join Date: Jan:2007
    Location: UK
    Posts: 540
    , , - . , . (-, -) - - , "" . - O(n), O(nlogn/n^2) .

  10. #10
    no brain no pain baracuda's Avatar
    Join Date: Aug:2006
    Location: Sofia
    Posts: 35,840
    " - O(n)" ? - , ( ) ? N-1 .
    - , , "n", ? , - O(nlogn) - QuickSort), .

  11. #11
    Registered User FuLLmaXx's Avatar
    Join Date: Jan:2007
    Location: UK
    Posts: 540
    - - 2 : insertion sort merge sort. O(n^2) O(nlogn). - 32 , 32 . , - -, - nlogn . "", (5, 1, 3, 1) (1, 1, 3, 5), , 2 . Insertion sort - n^2 , - nlogn merge sort. n^2 nlogn, - -, , .
    , - insertion sort n, -/- , , . ( -/ ), 1 n, - .
    Last edited by FuLLmaXx; 26th September 2012 at 14:46.

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 |