C++ 在c+中使用visual studio编码的程序时,执行自动退出+;

C++ 在c+中使用visual studio编码的程序时,执行自动退出+;,c++,image,visual-studio-express,C++,Image,Visual Studio Express,当我执行程序时,执行会自动停止。我访问此功能多个图像。代码如下 #include "rt_nonfinite.h" #include "multiplyImage.h" /* Function Declarations */ static double rt_roundd_snf(double u); /* Function Definitions */ static double rt_roundd_snf(double u) { double y; if (fabs(u) <

当我执行程序时,执行会自动停止。我访问此功能
多个图像
。代码如下

#include "rt_nonfinite.h"
#include "multiplyImage.h"

/* Function Declarations */
static double rt_roundd_snf(double u);

/* Function Definitions */
static double rt_roundd_snf(double u)
{
  double y;
  if (fabs(u) < 4.503599627370496E+15) {
    if (u >= 0.5) {
      y = floor(u + 0.5);
    } else if (u > -0.5) {
      y = u * 0.0;
    } else {
      y = ceil(u - 0.5);
    }
  } else {
    y = u;
  }

  return y;
}

void multiplyImage(const unsigned char img[/*2115216*/6], double parameter, unsigned
                   char imgout[/*2115216*/6])
{
  int i0;
  double d0;
  unsigned char u0;

  /*  implements a function that multiplies an image with a parameter */
  for (i0 = 0; i0 < 6; i0++)
  {
    d0 = rt_roundd_snf(parameter * (double)img[i0]);
    if (d0 < 256.0) 
    {
      if (d0 >= 0.0) {
        u0 = (unsigned char)d0;
      } else 
      {
        u0 = 0;
      }
    } else if (d0 >= 256.0)
    {
      u0 = MAX_uint8_T;
    } else
    {
      u0 = 0;
    }

    imgout[i0] = u0;
    Ou[i0] = imgout[i0];
  }
  printf(d0);

}
#包括“rt_nonfinite.h”
#包括“multiplyImage.h”
/*函数声明*/
静态双rt_roundd_snf(双u);
/*函数定义*/
静态双rt\u圆D\u snf(双u)
{
双y;
if(晶圆厂(u)<4.503599627370496E+15){
如果(u>=0.5){
y=地板(u+0.5);
}否则如果(u>-0.5){
y=u*0.0;
}否则{
y=ceil(u-0.5);
}
}否则{
y=u;
}
返回y;
}
void multiplyImage(常量无符号字符img[/*2115216*/6],双参数,无符号
字符符号[/*2115216*/6])
{
int-i0;
双d0;
无符号字符u0;
/*实现将图像与参数相乘的函数*/
对于(i0=0;i0<6;i0++)
{
d0=rt_roundd_snf(参数*(双)img[i0]);
如果(d0<256.0)
{
如果(d0>=0.0){
u0=(无符号字符)d0;
}否则
{
u0=0;
}
}否则如果(d0>=256.0)
{
u0=最大值uint8_UT;
}否则
{
u0=0;
}
imgout[i0]=u0;
Ou[i0]=imgout[i0];
}
printf(d0);
}
当执行到printf时,执行会自动停止。img[6]和imgout[6]只是为了测试工作而创建的虚拟图像。。我在另一个主函数中使用这个函数,如下所示

unsigned char test[6];

for (int c = 0; c < color; ++c)
    {
        for (int h = 0; h < height; ++h)
        {
            for (int w = 0; w < width; ++w)
            {
                x = 'R';
                Image_Conversion(c, h, w) = x;
                test[c*h*w] = Image_Conversion(c, h, w);
                std::cout << "Test:  " << test[c*w*h];
            }
        }
    }
multiplyImage(&(const unsigned char)test[6], 1, &test[6]);
无符号字符测试[6];
对于(int c=0;cd0
是double类型,您应该告诉
printf
。请尝试以下代码:

printf("%f", d0);

查看printf的文档。+1我甚至没有看到
printf
调用。太糟糕了,我的视觉子系统过滤掉了它。