| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 531 人关注过本帖
标题:VC++6.0 运行提示应用程序出错
只看楼主 加入收藏
pemi2010
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2010-2-20
结帖率:50%
收藏
已结贴  问题点数:20 回复次数:3 
VC++6.0 运行提示应用程序出错
#include <stdio.h>
#include <stdlib.h>

void main()
{
 int r;  /*the approximate length of probable crime scope */
    int x1; /*the number of commited crime spots*/
 float c,d,e,f;/*probability of the spot weighed by distance*/
 int i,j,k;/*loop control variable*/

 printf("Please input the approximate length(integer) of probable crime scope:\n");
 int ret;
 ret=scanf("%f",&r);
 if (ret==0)
 {
  printf("Input r data type error!\n");
  fflush(stdin);
 }
 else if(ret==EOF)
 {
  printf("Input r failure occures!\n");
 }
 else
 {
  printf("Please input the number of commited crime spots:(<100)");
  int ret2;
  ret2=scanf("%d",&x1);
  if (ret2==0)
  {
   printf("Input x1 data type error!\n");
   fflush(stdin);
  }
  else if(ret2==EOF)
  {
   printf("Input x1 failure occures!\n");
  }
  else if(x1>=100)
  {
   printf("too large!!!x1 can't be larger than 100!");
  }

  else
  {
   int a[100];
   int b[100];

   printf("Please input the modified abscissa in order:\n");
   for(i=0;i<x1;i++)
   {
    scanf("%d",&a[i]);
   }

   printf("Please input the modified ordinates in order:\n");
   for(j=0;j<x1;j++)
   {
    scanf("%d",&b[j]);
   }


   float matrix[1000][1000];/*store the probabilities of each spot*/
   for(i=0;i<r;i++)
   {
    for(j=0;j<r;j++)
    {
     for(k=0;k<x1;k++)
     {
      if((i==a[k])&&(j==b[k]))
      {
       matrix[i][j]=1;
      }
      else
      {
       matrix[i][j]=0;
      }
     }
    }
   }

   printf("Enter the probabilities of the spotsin order like this:c,d,e,f\n");
   scanf("%f,%f,%f,%f",&c,&d,&e,&f);

   for(i=0;i<x1;i++)
   {
    for(j=0;j<r;j++)
    {
     for(k=0;k<r;k++)
     {
      if((a[i]-j<=3)&&(a[i]-j>=-3)&&(b[i]-k<=3)&&(b[i]-k>=-3))
      {
       matrix[j][k]+=c;
      }
      else if((a[i]-j<=6)&&(a[i]-j>=-6)&&(b[i]-k<=6)&&(b[i]-k>=-6))
      {
       matrix[j][k]+=d;
      }
      else if((a[i]-j<=9)&&(a[i]-j>=-9)&&(b[i]-k<=9)&&(b[i]-k>=-9))
      {
       matrix[j][k]+=e;
      }
      else if((a[i]-j<=12)&&(a[i]-j>=-12)&&(b[i]-k<=12)&&(b[i]-k>=-12))
      {
       matrix[j][k]+=f;
      }
     }
    }
   }


   float max=matrix[0][0];
   int row,column;
   for(i=0;i<r;i++)
   {
    for(j=0;j<r;j++)
    {
     if(max<matrix[i][j])
     {
      max=matrix[i][j];
      row=i+1;
      column=j+1;
     }
    }
   }
   printf("max=%f,row=%d,column=%d\n",max,row,column);

   printf("all probabilities within the crime scope is like this:\n");
   for(i=0;i<r;i++)
   {
    for(j=0;j<r;j++)
    {
     printf("%5.4f ",matrix[i][j]);
    }
    printf("\n");
   }
  }
  
 }

}
提示的错误为:
应用程序发生异常 unknown software exception (0xc00000fd),位置为0x00401cd7
搜索更多相关主题的帖子: 提示 运行 应用程序 
2010-02-20 11:12
pemi2010
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2010-2-20
收藏
得分:0 
坐等回复。。。。。
2010-02-20 11:12
cnfarer
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:179
帖 子:3330
专家分:21157
注 册:2010-1-19
收藏
得分:20 
float matrix[1000][1000];/*store the probabilities of each spot*/
=====>
float matrix[100][100];/*store the probabilities of each spot*/

★★★★★为人民服务★★★★★
2010-02-20 11:45
pemi2010
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2010-2-20
收藏
得分:0 
谢谢~~~~~~~~~~~
2010-02-20 11:50
快速回复:VC++6.0 运行提示应用程序出错
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.024400 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved