void pearson (double d[][w2], float trn[][k1], float tst[][k1], int w, int k)
{
float x_sr,y_sr; //srednie x i y
float x_szereg=0,y_szereg=0; //zmienne do szeregow w mianownikach
float temp=0,temp2;
float r[4][6];
for(int i=0;i<w;i++)
{
x_sr = x_srednia(trn,i);
for(int y=0;y<k;y++)
{
y_sr = y_srednia(tst,y);
for(int h=0;h<k1-1;h++)
{
x_szereg += (trn[i][h] - x_sr) * (trn[i][h] - x_sr);
}
x_szereg = sqrt(x_szereg/(k1-1));
//cout<<x_szereg<<endl;
for(int h=0;h<k1-1;h++)
{
y_szereg += (tst[y][h] - y_sr) * (tst[y][h] - y_sr);
}
y_szereg = sqrt(y_szereg/(k1-1));
//cout<<y_szereg<<endl;
for(int j=0;j<k1-1;j++)
{
temp += ((trn[i][y] - x_sr) / x_szereg)*((tst[y][j] - y_sr) / y_szereg);
}
r[i][y]=temp/(k1-1);
temp2=r[i][y];
bezwzgledna(temp2);
d[i][y]=1-temp2;
//cout<<temp2<<endl;
//printf("%.20f",d[i][y]);
//cout<<endl;
//cout<<d[i][y]<<endl;
x_szereg=0;
y_szereg=0;
temp=0;
}
}
}
nie wiem czemu przy tablicy r wywala mi:
Run-Time Check Failure #2 - Stack around the variable 'r' was corrupted.
aha kilka stałych użytych w tej funkcji:
const int w1=6; //wiersze w TRN
const int w2=6; //wiersze w TST
const int k1=5; //kolumny w TST i TRN
const int klas=2; //klasyfikacja k
BTW
chciałbym teraz wykonać graficzny interfejs w vs2010 (windows forms) to tej konsolowej aplikacji, możecie mi podać kilka linków na jakiś dobry tutorial?