Results 1 to 16 of 16

Thread: 2 ++.

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User martos1's Avatar
    Join Date: Nov:2010
    Location: Sofiq
    Posts: 95

    2 ++.

    2 " " .
    Code:
    #include <iostream.h>
    int main()
    {
    int m,n,k,i,j,l;
    float a[m][n],b[n][k],p[m][k];
    cout<<"vavedi m:";
    cin>>m;
    cout<<"vavedi n:";
    cin>>n;
    cout<<"vavedi k:";
    cin>>k;
    cout<<"Vavedete masiv a:";
    for(j=0;j<m;j++)
    {
    cout<<" "<<j+1<<"red:";
    for(i=0;i<n;i++)
    {
    cout<<i+1<<"-i element:";
    cin>>a[j][i];
    }
    }
    cout<<"Vavedete masiva b:";
    for(j=0;j<n;j++)
    {
    cout<<" "<<j+1<<"red:";
    for(i=0;i<k;i++)
    {
    cout<<i+1<<"-i element:";
    cin>>b[j][i];
    }
    }
    for(j=0;j<m;j++)
    for(i=0;i<k;i++)
    {
    for(l=0;l<n;l++)
    p[j][i]=a[j][l]*b[l][i];
    }
    for(j=0;j<m;j++)
    for(i=0;i<k;i++)
    {
    cout<<"p["<<j<<"]["<<i<<"]="<<p[j][i]<<endl;
    }
        return 0;
    }
    :
    ( , ). . .

    , .
    ( 2 6 )

    Code:
    #include <iostream.h>
    int main()
    {
    int m,n,a[m][n],i,j;
    double sr;
    sr=0;
    cout<<"Broi uchenici:";
    cin>>m;
    cout<<"Broi predmeti:";
    cin>>n;
    for(i=0;i<m;i++)
    for(j=0;j<n;j++)
    {
    cout<<"a["<<i<<"]["<<j<<"]=";
    cin>>a[i][j];
    }
    cout<<"Izvejdane na uchenika sys nai-visok sreden uspeh:"<<endl;
    for(i=0;i<m;i++)
    for(j=0;j<n;j++)
    {
    sr=sr+a[i][j];
    }
    sr=sr/(m*n);
    cout<<"Sreden uspeh:"<<sr<<endl;
    
    
        return 0;
    }

  2. #2
    Registered User
    Join Date: Oct:2003
    Location:
    Posts: 4,317
    C .
    , int n; float a[n]; cin<<n .

  3. #3
    Registered User martos1's Avatar
    Join Date: Nov:2010
    Location: Sofiq
    Posts: 95
    Quote Originally Posted by bsb View Post
    C .
    , int n; float a[n]; cin<<n .
    .( )
    cin<<n .

  4. #4
    System.gc()'s Avatar
    Join Date: Apr:2007
    Location: back in time
    Posts: 1,075
    <offtopic>


    : , .
    - ,
    , ( ).
    Python .

    </offtopic>

    , bsb ,
    , , ""-.
    UD3R|Q9550+1283|4x2 G.Skill@1066|MX500+1002FAEX+640AAKS+ST31 60|RX580-8GB|1841BLT|SS-760XP|Define7|z24i|Edifier S350DB
    geniusloci: ) ; ) ; ) ? nope|r.i.p.

  5. #5
    Developer/Gamer tengam's Avatar
    Join Date: Feb:2005
    Location:
    Posts: 1,459
    2- :
    Code:
    #include <iostream>
    #include <ctime>
    using namespace std;
    
    int main()
    {
    	int m,n;
    	int *iOcenki;
    	double *iUspeh;
    	double sr = 0;
    	int flag=0;
    
    	cout<<"Broi uchenici:";
    	cin>>m;
    	cout<<"Broi predmeti:";
    	cin>>n;
    
    	iOcenki = new int[m*n];
    	iUspeh = new double[m];
    
    	srand(time(NULL));
    	cout<<endl;
    
    	for(int i=0;i<n;i++){
    		iUspeh[i] = 0;
    		for(int j=0;j<m;j++){
    			iOcenki[i*n+j] = rand()% 4 + 2;
    			iUspeh[i] += iOcenki[i*n+j];
    		}
    		iUspeh[i] /= m;
    		cout<<iUspeh[i]<<"  ";
    		
    	}
    
    	sr = iUspeh[0];
    	for(int i=0;i<m;i++){
    		if(sr < iUspeh[i]){
    			sr = iUspeh[i];
    			flag = i;
    		}
    	}
    	cout<<endl<<endl<<"Uchenik "<<flag<<"(index) e s nai-visok sreden uspeh: "<<sr<<endl;
    
    	delete [] iOcenki;
    	delete [] iUspeh;
    	return 0;
    }
    /Hidden:
    |ASUS RoG Z690-E i7-13700k@ 5.6/4.3Ghz + Kraken X63 216GB Kingston Fury Beast 6000hmz 32-40-40-28 | RTX4080 | 256GB 960Evo, 1TB 970Evo, 2x2TB 980Pro, 1TB 860Evo|HX1200|CM MasterCase Pro 5|
    |Steam Deck 256GB | 36 TB Unraid NAS| Asus Z87-DELUXE i7-4790K 32GB DDR3|
    TengaM#2700 / 7engaM

  6. #6
    Registered User martos1's Avatar
    Join Date: Nov:2010
    Location: Sofiq
    Posts: 95
    Quote Originally Posted by System.gc() View Post
    <offtopic>


    : , .
    - ,
    , ( ).
    Python .

    </offtopic>

    , bsb ,
    , , ""-.
    , ,

    double int , .

    .
    .
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	untitled.JPG‎ 
Views:	273 
Size:	35.6 KB 
ID:	35918  
    Last edited by martos1; 19th January 2011 at 22:59.

  7. #7
    Wall-e delian's Avatar
    Join Date: May:2003
    Location: ::1
    Posts: 4,723
    Code:
    float a[m][n],b[n][k],p[m][k];

    Code:
    float a[100][100],b[100][100],p[100][100];
    , tengam - , .

  8. #8
    Developer/Gamer tengam's Avatar
    Join Date: Feb:2005
    Location:
    Posts: 1,459
    OFF /*
    , ? , .
    */ OFF
    |ASUS RoG Z690-E i7-13700k@ 5.6/4.3Ghz + Kraken X63 216GB Kingston Fury Beast 6000hmz 32-40-40-28 | RTX4080 | 256GB 960Evo, 1TB 970Evo, 2x2TB 980Pro, 1TB 860Evo|HX1200|CM MasterCase Pro 5|
    |Steam Deck 256GB | 36 TB Unraid NAS| Asus Z87-DELUXE i7-4790K 32GB DDR3|
    TengaM#2700 / 7engaM

  9. #9
    Registered User martos1's Avatar
    Join Date: Nov:2010
    Location: Sofiq
    Posts: 95
    Quote Originally Posted by delian View Post
    Code:
    float a[m][n],b[n][k],p[m][k];

    Code:
    float a[100][100],b[100][100],p[100][100];
    , tengam - , .
    Ta , .
    :
    (M,N) (N,K). P(M,K).



    , . , , .

    , , .

  10. #10
    Wall-e delian's Avatar
    Join Date: May:2003
    Location: ::1
    Posts: 4,723
    , . , , .

  11. #11
    Registered User
    Join Date: Oct:2003
    Location:
    Posts: 4,317
    . , , , ? , .

  12. #12
    Wall-e delian's Avatar
    Join Date: May:2003
    Location: ::1
    Posts: 4,723
    Quote Originally Posted by martos1 View Post
    Ta ...
    - :

    Code:
    const int m=100, n=100, k=100;
    float a[m][n],b[n][k],p[m][k];
    Quote Originally Posted by bsb View Post
    . , , , ? , .

  13. #13
    Registered User martos1's Avatar
    Join Date: Nov:2010
    Location: Sofiq
    Posts: 95
    Quote Originally Posted by bsb View Post
    . , , , ? , .
    , , .

    : bsb


    Code:
    #include <iostream.h>
    int main()
    {
    int m,n,k,i,j,l;
    float a[100][100],b[100][100],p[100][100];
    cout<<"vavedi m:";
    cin>>m;
    cout<<"vavedi n:";
    cin>>n;
    cout<<"vavedi k:";
    cin>>k;
    cout<<"Vavedete masiv a:";
    for(j=0;j<m;j++)
    	{
    	cout<<" "<<j+1<<"red:";
    	for(i=0;i<n;i++)
    		{
    		cout<<i+1<<"-i element:";
    		cin>>a[j][i];
    		}
    	}
    cout<<"Vavedete masiva b:";
    for(j=0;j<n;j++)
    	{
    	cout<<" "<<j+1<<"red:";
    	for(i=0;i<k;i++)
    		{
    		cout<<i+1<<"-i element:";
    		cin>>b[j][i];
    		}
    	}
    for(j=0;j<m;j++)
    	{
    	for(i=0;i<k;i++)
    		{
    		for(l=0;l<n;l++)
    			{
    			p[j][i]=p[j][i]+a[j][l]*b[l][i];
    			}
    		}
    	}
    for(j=0;j<m;j++)
    for(i=0;i<k;i++)
    	{
    	cout<<"p["<<j<<"]["<<i<<"]="<<p[j][i]<<endl;
    	}
        return 0;
    }
    Last edited by martos1; 21st January 2011 at 20:52.

  14. #14
    Registered User martos1's Avatar
    Join Date: Nov:2010
    Location: Sofiq
    Posts: 95
    2- .
    - :
    U[1]=5.25

    EDIT:


    Code:
    #include <iostream.h>
    int main()
    {
    int m,n,i,j;
    float a[100][100],u[100];
    cout<<"Broi uchenici:";
    cin>>m;
    cout<<"Broi predmeti:";
    cin>>n;
    for(i=0;i<m;i++)
    for(j=0;j<n;j++)
    {
    cout<<"a["<<i<<"]["<<j<<"]=";
    cin>>a[i][j];
    u[i]=u[i]+a[i][j];
    }
    for(i=0;i<m;i++)
    {
    cout<<"Nai visok uspeh na uchenik u["<<i<<"] "<<(u[i]/n)<<endl;
    }
        return 0;
    }


    ---------- Post added at 01:07 ---------- Previous post was Yesterday at 21:01 ----------

    , for
    Code:
    #include <iostream.h>
    int main()
    {
    int m,n,i,j;
    float a[100][100],u[100],max=0;
    cout<<"Broi uchenici:";
    cin>>m;
    cout<<"Broi predmeti:";
    cin>>n;
    for(i=0;i<m;i++)
    for(j=0;j<n;j++)
                    {
                    cout<<"a["<<i<<"]["<<j<<"]=";
                    cin>>a[i][j];
                    u[i]=u[i]+a[i][j];
                    }
    for(i=0;i<m;i++)
    {
    if(u[i]>max)
    max=u[i];
    }
    cout<<"Nai visok uspeh na uchenik nomer "<<i<<" s uspeh "<<max/n<<endl;
        return 0;
    }
    Last edited by martos1; 21st January 2011 at 22:50.

  15. #15
    @ alfa
    Join Date: Nov:2007
    Location:
    Posts: 156
    for, , . cout- , i.

  16. #16
    Registered User martos1's Avatar
    Join Date: Nov:2010
    Location: Sofiq
    Posts: 95
    Quote Originally Posted by kingsshark View Post
    for, , . cout- , i.

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 |