| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 574 人关注过本帖
标题:出现程序出现访问违规。 但是我找不出哪里出界了
取消只看楼主 加入收藏
thelastone
Rank: 2
等 级:论坛游民
帖 子:14
专家分:14
注 册:2013-11-23
结帖率:100%
收藏
已结贴  问题点数:20 回复次数:1 
出现程序出现访问违规。 但是我找不出哪里出界了
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
    double s,a,v,t,r,PI=3.1415;
    double r1,t1,v1,v2,s1,s2,c=0,b,f;
    printf("qingshuru s,a,v,t,r\n");
    scanf("%lf,%lf,%lf,%lf,%lf");
    if(s>0 && t>0)
    {
            v1=v*sin(a*PI/180);
            v2=v*cos(a*PI/180);
            t1=2*v1/20;
            if(a==90)
            {
                     s2=v*t;
                     b=s2*s2+s*s;
                     r1=sqrt(b);
                     if(r1<=r)
                     {
                              c=1;
                     }
            }
            else
            {
                if(t1>=t)
                {
                         s1=v2*t;
                         t1/=2;
                         if(t>t1)
                         {
                                     s2=v1*v1/20;
                                     b=10*(t-t1)*(t-t1);
                                     s2 -=b;
                                     f=s1-s;
                                     r1=sqrt(s2*s2+f*f);
                                     if(r1<=r)
                                     {
                                          c=1;
                                     }
                         }
                         else
                         {
                             s2=v1*t-10*t*t;
                             s1=s1-s;
                             b=s2*s2+s1*s1;
                             r1=sqrt(b);
                                     if(r1<=r)
                                     {
                                          c=1;
                                     }
                         }
                }
                else
                {
                    s1=v2*t1;
                    s1-=s;
                    if(s1<=r)
                    {
                             c=1;
                    }
                }
            }
            if(c==1)
            {
                   printf("nice\n");
            }
            else
            {
                printf("T^T\n");
            }
    }
    else
    {
        printf("error\n");
    }
    system("PAUSE");
    return 0;
}

麻烦也和我说一下栈内存出界的处理方法吧
搜索更多相关主题的帖子: include double 
2014-01-11 11:27
thelastone
Rank: 2
等 级:论坛游民
帖 子:14
专家分:14
注 册:2013-11-23
收藏
得分:0 
回复 2楼 神vLinux飘飘
哎呀。。。。好低级的错误。。。。
2014-01-11 18:33
快速回复:出现程序出现访问违规。 但是我找不出哪里出界了
数据加载中...
 
   



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

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