Exécution d'un programme en c++
salut,
j'ai un programme qui est destiné d'afficher une matrice qui représente un masque du filtre de gauss mais lorsque j'exécute le programme rien ne s'affiche.
Code:
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 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149
| // mat.cpp: implementation of the mat class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "mat.h"
#include "vector.h"
#include "math.h"
#include <stdio.h>
#include <stdlib.h>
#include <iostream.h>
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
mat::mat()
{
}
mat::~mat()
{
}
void mat::mask()
{
double KR;
double R=0;
double S=0;
int M;
double A=0;// nombre de points dans N
double sum=0;
double K;
double moy=0;
double matr[15][15];
int mat1[15][15];
for(double k=15;k<30;k=k+15)
{
for(int i=7,x=0;i<15;i++,x++)
{
for(int j=7,y=0;j>0;j--,y++)
{
U= x*cos((2*3.14)*6/90) - y*sin((2*3.14)*6/90);
V= x*cos((2*3.14)*6/90) + y*sin((2*3.14)*6/90);
}
}
R=U;
S=V;
// for( k=15;k<180;k=k+15)
// {
for(i=7,x=0;i>0;i--,x--)
{
for(int j=7,y=0;j<15;j++,y--)
{
U= R+(x*cos((2*3.14)*6/90) - y*sin((2*3.14)*6/90));
V=S+( x*cos((2*3.14)*6/90) + y*sin((2*3.14)*6/90));
}
}
//}
R=U;
S=V;
//for( k=15;k<180;k=k+15)
// {
for( i=7,x=0;i<15;i++,x++)
{
for(int j=7,y=0;j<15;j++,y--)
{
U= R+(x*cos((2*3.14)*6/90) - y*sin((2*3.14)*6/90));
V= S+(x*cos((2*3.14)*6/90)+ y*sin((2*3.14)*6/90));
}
}
// }
R=U;
S=V;
// for( k=15;k<180;k=k+15)
// {
for( i=7,x=0;i>0;i--,x++)
{
for(int j=7,y=0;j<15;j--,y--)
{
U= R+(x*cos((2*3.14)*6/90) - y*sin((2*3.14)*6/90));
V= S+(x*cos((2*3.14)*6/90) + y*sin((2*3.14)*6/90));
}
}
}
for( int i=0;i<15;i++)
{
for(int j=0;j<15;j++)
{
if((U<6)&&(U> -6) && (V<4) && (V>-4))
{
K= -(exp(-(U*U)/8));
matr[i][j]=K;
sum=sum+K;
if(K!=0)
{
A=A+1;
}
else
{
matr[i][j]=0;
}
}
}
}
moy=sum/A;
cout<<"la somme est"<<sum<<endl;
cout<<"la moyenne est"<<moy<<endl;
for( i=0;i<15;i++)
{
for(int j=0;j<15;j++)
{
if(matr[i][j]!=0)
{
KR= matr[i][j]- moy;
M= (int)KR*10;
mat1[i][j]=M;
cout<<mat1[i][j]<<endl;
}
}
}
} |
lorsque j'exécute le programme il s'affiche juste une fenetre noir et lorsque j'ai changé dans le type de quelques données il s'affiche -1.#ND. je sais pas qu'est ce que cela veut dire.si quelqu'un sait comment je peux faire fonctionner ce programme.