Results 1 to 5 of 5

Thread: C++

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User ogun's Avatar
    Join Date: Jul:2009
    Location:
    Posts: 3,936

    C++

    , , :
    error C2296: '/' : illegal, left operand has type 'double *'

    : s[i] = s[i]/n;

    double?

    e :
    Code:
    #include <iostream.h>
    #include <process.h>
    void main ()
    {
    	/////////////////////
    	double n, m;
    	int * * a;
    	double * * s;
    	double * * g;
    	int i,j;
    	////////////////////
    
    	///////////////////
    	do{
    		cout<<"Vuvedete N v intervala ot 10 do 30: \n";
    		cin>>n;
    	}while(n<10 || n> 30);
    	
    	do{
    		cout<<"Vuvedete M v intervala ot 4 do 10: \n";
    		cin>>m;
    	}while(m<4 || m> 10);
    	////////////////////
    
    	///////////////
    	n = n+1;
    	m = m+1;
    	///////////////
    
    	///////////////////
    	a = new int *[n];
    	s = new double *[n];
    	g = new double *[n];
    	//
    	for(i=1; i<n; i++){
    		a[i]=new int [m];
    	}
    	///////////////////
    
    	//////////////////
    	for(i=1; i<n; i++){
    		for(j=1; j<m; j++){
    			cout<<"Vuvedete ocenka za student "<<i<<" i ocenka po predmet "<<j<<"\n";
    			cin>>a[i][j];
    		}
    	}
    	//////////////////
    
    	////////////////////
    	for(i=1; i<=n; i++){
    		s[i] = 0;
    		for(j=1; j<=m; j++){
    			s[i] += a[i][j];
    		}
    	}
    	////////////////////
    
    	//////////////////
    	for(j=1; j<=m; j++){
    		g[j] = 0;
    		for(i=1; i<=n; i++){
    			g[j] += a[i][j];
    		}
    	}
    	///////////////////
    
    	///////////////////
    	cout<<"Sredni ocenki na studenti: \n";
    
    	for(i=1; i<=n; i++){
    		s[i] = s[i]/n;
    	}
    	///////////////////
    
    	///////////////////
    	system("Pause");
    }
    .

  2. #2
    Registered User
    Join Date: Dec:2007
    Location: Sofia
    Posts: 366
    ; '/' .

    Quote Originally Posted by ogun View Post
    double?
    , double?

  3. #3
    Registered User ogun's Avatar
    Join Date: Jul:2009
    Location:
    Posts: 3,936
    Quote Originally Posted by Pheoman View Post
    ; '/' .



    , double?

    , , . - ?
    .

  4. #4
    Registered User
    Join Date: Dec:2007
    Location: Sofia
    Posts: 366
    's' , .

    ..

    Code:
    double *s;
    ...
    s = new double[n];
    . 'n' 'm' double, int? 'g'?

  5. #5
    ɐ-əpoɔᴉu⋂ ɐ ə anrieff's Avatar
    Join Date: Apr:2004
    Location: Sofia
    Posts: 8,448
    ,
    , . .
    "640K ught to be enough for anybody" - Bill Gates, 1981
    ::Machine specs::Fract::AGG::::Baileys::blog::YouTube channel

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 |