Page 1 of 2 12 LastLast
Results 1 to 25 of 30

Thread:

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User demonskater's Avatar
    Join Date: Sep:2009
    Location: Varna
    Posts: 103



    , . , . ) , .

    :

    #include<iostream>
    #include <stdlib.h>
    using namespace std;
    #define N 100;
    int broj;
    int A[6][3]
    void generate();
    int konkreten();
    int kolichestwa();
    int desette();
    int menu();

    void main()
    {int choice,i,n;

    do{
    cout<<"Broj tiraji:";
    cin>>broj;
    }
    while(broj<1||broj>100);

    do{ choice=menu();
    switch(choice)
    {case 1:generate();break;
    case 2:kolichestwa();break;
    case 3:desette();break;
    case4:konkreten();break;
    default:cout<<"Greshen izbor!";break;
    }
    }while(choice!=5);
    }

    int menu()
    {int choice;
    cout<<"\n Izberete opciq:";
    cout<<"\n 1.Generirane na chisla!";
    cout<<"\n 2.Kolichestwa chisla ot vsqko ot izteglenite chisla";
    cout<<"\n 3.Desette nai-chesto izteglqni chisla";
    cout<<"\n 4.Konkreten tiraj i chislata ot nego";
    cout<<"\n 5.Exit";
    cout<<"\Izbor:";
    cin>>choice;
    return choice;
    }

    void generate()
    {int k,i,j,gen;

    for(k=0;k<broj;k++)
    for(i=0;i<6;i++)
    for(j=0;j<3;j++)
    {gen=rand();
    do{ gen=A[i][j];}
    while(gen<6||gen>49);
    }
    }
    , .

  2. #2
    Game programmer
    Join Date: Feb:2007
    Location:
    Posts: 1,948
    . , ,

    Code:
    {int k,i,j,gen;
    . -, .

    Code:
    for(int k=0;k<broj;k++)
    for(int i=0;i<6;i++)
    for(int j=0;j<3;j++)


    Code:
    {gen=rand();
    rand() . . , time() srand() - google rand() srand() .

    Code:
    do{ gen=A[i][j];}
    ?!

    Code:
    while(gen<6||gen>49);
    6 49


    ,

  3. #3
    Registered User demonskater's Avatar
    Join Date: Sep:2009
    Location: Varna
    Posts: 103
    #include<iostream>
    #include<stdlib.h>
    #include<time.h>
    using namespace std;
    int main()
    {int A[6][3],gen;
    time_t t;
    srand ((unsigned) time(&t));


    for(int i=0;i<7;i++)
    for(int j=0;j<4;j++)
    {gen=rand()%50;
    if(gen>6) gen=A[i][j];
    }

    for(int i=0;i<7;i++)
    for(int j=0;j<4;j++)
    cout<<A[i][j]<<endl;
    }
    .. ?
    , .

  4. #4
    Registered User martos1's Avatar
    Join Date: Nov:2010
    Location: Sofiq
    Posts: 95
    Quote Originally Posted by demonskater View Post
    #include<iostream>
    #include<stdlib.h>
    #include<time.h>
    using namespace std;
    int main()
    {int A[6][3],gen;
    time_t t;
    srand ((unsigned) time(&t));


    for(int i=0;i<7;i++)
    for(int j=0;j<4;j++)

    {gen=rand()%50;
    if(gen>6) gen=A[i][j];
    }

    for(int i=0;i<7;i++)
    for(int j=0;j<4;j++)
    cout<<A[i][j]<<endl;
    }
    .. ?
    A ?

  5. #5
    Registered User demonskater's Avatar
    Join Date: Sep:2009
    Location: Varna
    Posts: 103
    3 6 , ... .
    , .

  6. #6
    Registered User martos1's Avatar
    Join Date: Nov:2010
    Location: Sofiq
    Posts: 95
    Quote Originally Posted by demonskater View Post
    3 6 , ... .
    I J 0 7 4
    [0][0], A[0][1] ...

  7. #7
    Registered User
    Join Date: Aug:2008
    Location: Varna
    Posts: 291
    rand() % 49 + 1
    , 100 , 3 . . ! 10- -. 49 ( 1 ). .

    Edit: ...
    Last edited by IBM370; 17th December 2010 at 07:37.

  8. #8
    Registered User
    Join Date: Oct:2003
    Location:
    Posts: 4,317
    , " 6 49" , 6 49?
    "" . , , .. .

  9. #9
    Registered User demonskater's Avatar
    Join Date: Sep:2009
    Location: Varna
    Posts: 103
    , . , 49 ?
    , .

  10. #10
    Registered User
    Join Date: Aug:2008
    Location: Varna
    Posts: 291
    49 . . '' :
    Code:
     counters[tiraj/*0;1;2*/][num - 1]++.

  11. #11
    Registered User demonskater's Avatar
    Join Date: Sep:2009
    Location: Varna
    Posts: 103
    , :

    for(i=0;i<3;i++)
    for(j=0;j<6;j++)
    if(A[i][j]==1)
    , .

  12. #12
    Registered User
    Join Date: Aug:2008
    Location: Varna
    Posts: 291
    , ?

  13. #13
    Registered User demonskater's Avatar
    Join Date: Sep:2009
    Location: Varna
    Posts: 103
    , 49 ..
    , .

  14. #14
    Registered User
    Join Date: Aug:2008
    Location: Varna
    Posts: 291
    49 ? 49 ?

  15. #15
    Registered User demonskater's Avatar
    Join Date: Sep:2009
    Location: Varna
    Posts: 103
    A 1 , , 2 , 49 ? , , ..

    :

    for(i=0;i<3;i++)
    for(j=0;j<6;j++)
    if(A[i][j]==1) counters[broj/*0;1;2*/][num - 1]++;
    else if (A[i][j]==2) counters[broj/*0;1;2*/][num - 1]++;
    , .

  16. #16
    Registered User
    Join Date: Aug:2008
    Location: Varna
    Posts: 291
    :
    Code:
    int main() {
    	unsigned i, j, k, num;
    	unsigned long long mask, l;
    	
    	unsigned char data[100][3][6];
    	unsigned counters[3][49], top10[10];
    	
    	memset( counters, 0, sizeof(counters) );
    	
    	for( i = 0; i < 100; i++ ) /*  */
    	for( j = 0; j < 3; j++ ) /*  */ {
    		mask = 0;
    		
    		for( k = 0; k < 6; k++ ) /*  */ {
    			num = rand() % 49; /* [0 - 48] */
    			
    			if( num > 24 ) for( l = 0x01LL << num; mask & l; l >>= 1 ) num--;
    			else for( l = 0x01LL << num; mask & l; l += l ) num++;
    			
    			mask |= l;
    			data[i][j][k] = num + 1; /* [1 - 49] */
    			counters[j][num]++;
    		}
    	}
    	
    	/*     3-      ( ?). */
    	...
    	/*   10-   -   counters      . (top10) */
    	...
    	
    	return 0;
    }

  17. #17
    Registered User demonskater's Avatar
    Join Date: Sep:2009
    Location: Varna
    Posts: 103
    , , . , counters ?
    , .

  18. #18
    Registered User
    Join Date: Aug:2008
    Location: Varna
    Posts: 291
    . data . counters , . 0 1, 1 2.. 5 counters[1 - 1][5 - 1]. top10. -.

  19. #19
    Registered User demonskater's Avatar
    Join Date: Sep:2009
    Location: Varna
    Posts: 103
    , 10 - . 49 , , - . :

    {int i,j,k,p,z,temp;
    int counters[49];
    int chisla[49]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16 ,17,18,19,20,21,22,23,24,25,26,27,28,29, 30,31,32,33,34,35,36,37,38,39,40,41,42,4 3,44,45,46,47,48,49};
    memset( counters, 0, sizeof(counters) );
    for(p=0;p<49;p++)
    for(k=0; k<broj; k++)
    {
    for(i=0; i<3; i++)
    {
    for(j=0;j<6;j++)
    {
    if(tiraji[k].A[i][j]==chisla[p])
    counters[p]++;

    }

    }
    }
    for(p=0;p<48;p++)
    for(z=p+1;z<49;z++)
    if(counters[p]>counters[z])
    {temp=counters[p];
    counters[p]=counters[z];
    counters[z]=temp;
    }

    for(p=0;p<10;p++)
    {
    cout<<counters[p]<<"pyti \t\t"<<chisla[p]<<endl;
    }

    }
    Last edited by demonskater; 19th December 2010 at 21:29.
    , .

  20. #20
    Registered User
    Join Date: Aug:2008
    Location: Varna
    Posts: 291
    . - chisla counters. . counters[chisla[0] - 1] > counters[chisla[10] - 1] 2 chisla ( 1 11 ). . counters[chisla[0] - 1] - counters[chisla[48] - 1] -. 10 ( chisla ).

  21. #21
    Registered User demonskater's Avatar
    Join Date: Sep:2009
    Location: Varna
    Posts: 103
    .. , ?
    , .

  22. #22
    Registered User
    Join Date: Aug:2008
    Location: Varna
    Posts: 291
    . - - 1 ( 1 49 0 48 ). , .

  23. #23
    Registered User demonskater's Avatar
    Join Date: Sep:2009
    Location: Varna
    Posts: 103
    if(tiraji[k].A[i][j]==chisla[p])
    counters[p]++;

    ?
    , .

  24. #24
    Registered User
    Join Date: Aug:2008
    Location: Varna
    Posts: 291
    . . p + 1 == chisla[p]. p ? counters[ tiraji[k].A[i][j] - 1 ]++. p.

  25. #25
    Registered User demonskater's Avatar
    Join Date: Sep:2009
    Location: Varna
    Posts: 103
    , :

    counters[chisla[0] - 1] > counters[chisla[10] - 1]

    ?
    , .

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 |