000
13.04.2010, 17:56 Uhr
Emel
|
Hallo Zusammen,
vielleicht könntet ihr mir auch bei dem Problem, wie soll ich c deklarieren damit c in der Funktion geändert wird??
C++: |
#include <iostream> #include <stdio.h>
using namespace std;
void DIRSamplepoints(double c[][64],int ArrayI[],double delta,int sample,int start,int length[][64],double f[][2],int frei,int maxI,int point[],double x[],int n,int oops);
int length[10000][64]; double f[10000][2];
int main() { int sample; sample = 0; int frei; frei = 0; int n; n = 2; int *ArrayI; ArrayI = new int[64]; int *point; point = new int[1000]; double *x; x = new double[n]; double (*c)[64]; c = new double[10000][64];
for(int i=0;i<n;i++){ ArrayI[i]=i+1; } for(int j=0;j<n;j++){ c[0][j] = 0.5; x[j] = 0.5; length[0][j] = 0; } double delta; delta = 0.333; int start; start =0; int maxI; maxI = 2; int oops; oops=0; int maxfunc= 1000; for(int i=0;i<maxfunc-1;i++){ point[i] = i+1; } //printf("f %f\n point[700] %d\n",f[i][1],point[700]); point[maxfunc-1] = 0; DIRSamplepoints(c,ArrayI,delta,sample,start,length,f,frei,maxI,point,x,n,oops); delete[]x; delete[]point; delete[]ArrayI; return 0;
}
void DIRSamplepoints(double c[][64],int ArrayI[],double delta,int sample,int start,int length[][64],double f[][2], int frei,int maxI,int point[],double x[],int n,int oops) {
int pos; int j,k; pos = frei; start = frei; //////////////////////////////////////////////////////////// for(k=0;k<2*maxI;k++){ for(j=0;j<n;j++){ length[frei][j] = length[0][j]; c[frei][j] = c[sample][j]; ////////////HIER ÄNDERT SICH DIE WERTE C[][] NICHT, ER ÜBERNIMMT EINFACH DIE ALTE WERTE. } pos = frei; frei= point[frei];
if(frei == 0){ printf("Error, no more free positions !"); oops = 1; return; } } point[pos] = 0; pos = start; for(j = 0;j<maxI;j++){ c[pos][ArrayI[j]] = c[sample][ArrayI[j]] + delta; pos = point[pos]; c[pos][ArrayI[j]] = c[sample][ArrayI[j]] - delta; pos = point[pos]; } }
|
Dieser Post wurde am 13.04.2010 um 17:58 Uhr von ao editiert. |