| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 874 人关注过本帖
标题:找了好久都不知道问题是什么else if运行混乱
取消只看楼主 加入收藏
corpsetsui
Rank: 1
等 级:新手上路
帖 子:15
专家分:4
注 册:2016-3-4
结帖率:33.33%
收藏
已结贴  问题点数:20 回复次数:0 
找了好久都不知道问题是什么else if运行混乱
以前运行的时候是正常的,但前两天运行的时候就突然else if就开始混乱了,后面还有程序的,但同样没有问题就不贴出来。找了好久都不知道问题出在哪里,求解答

// 200.cpp : 定义控制台应用程序的入口点。
//

#include "stdafx.h"
#include <iostream>
#include<stdio.h>
#include <math.h>
#define MAXCOUNT 400
using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
   
        void firstdata(float,float,float);
        float L1,L2,L3;
        void secondata(float,float,float);
        float i,j,k;
        void thirddata(float,float,float);
        float C1,O1,
        C2,O2,C3,O3;
        int count;
        float a,b,c,p,q,r,A,B,C;
        float target1,target2,target3;
        count=0;
        L3=0;
        L2=0;
        L1=0;
        while(count<=MAXCOUNT)
        {
                printf("\n===============");
                if(L1==0)
                {
                    printf("\n第一输入距离值 ");
                     scanf_s("%f",&L1);
                     printf("-----1/0判断: ");
                     scanf_s("%f",&i);
                    printf("第一次目标开始值: ");
                    scanf_s("%f",&O1);
                    printf("第一次目标结束值: ");
                     scanf_s("%f",&C1);
                    printf("\n==============");

                    printf("\n第二输入距离值 ");
                     scanf_s("%f",&L2);
                     printf("-----1/0判断: ");
                     scanf_s("%f",&j);
                    printf("第二次目标开始值: ");
                    scanf_s("%f",&O2);
                    printf("第二次目标结束值: ");
                     scanf_s("%f",&C2);
                    printf("\n==============");
                }
                else
                {
                    L1=L2;
                    L2=L3;
                    i=j;                   /*待处理,输出结果不正常*/
                    j=k;

                    C1=C2;
                    C2=C3;
                    O1=O2;
                    O2=O3;
                }               
               printf("\n第三输入距离值: ");
               scanf_s("%f",&L3);
               printf("-----上/下方向: ");
               scanf_s("%f",&k);
               printf("第三次目标开始值: ");
               scanf_s("%f",&O3);
               printf("第三次目标结束值: ");
               scanf_s("%f",&C3);
               printf("\n");

               p=fabs(sqrt(L1*L1-1));
               q=fabs(sqrt(L2*L2-1));
               r=fabs(sqrt(L3*L3-1));
               target1=C1-O1;
               target2=C2-O2;
               target3=C3-O3;
               a=q/p;
               b=r/q;
               c=r/p;
               A=fabs(target2/target1);
               B=fabs(target3/target2);
               C=fabs(target3/target1);

      if( i == 1 && j==1 && k==1)  /*1001---8672\\顺序号跳过-986*/
      {
             if(L1<L2 && L2<L3 )/*End of 2910*/  //第一个
             {
                  if(target1 == target2 && target2  ==  target3 && target3 ==0 )
                  {
                      if(a>b)
                      {
                          printf("-1001-ture");
                      }
                      else
                          printf("-1002-ture");
                  }
                  else if(target1 == target2 && target2== target3 && target1 != 0)
                  {
                      if(a>b)
                      {  
                          if(fabs(target1/p)>fabs(target2/q) && fabs(target2/q)>fabs(target3/r))
                          {
                              
                                  printf("-1003-");/*已修改1*/
   
                          }
                          else if(fabs(target1/p)>fabs(target2/q) && fabs(target2/q)<fabs(target3/r) && fabs(target1/p)>fabs(target3/r))
                          {
                              
                                  printf("-1004-ture");
                             
                          }
                          else if(fabs(target1/p)>fabs(target2/q) && fabs(target2/q)<fabs(target3/r) && fabs(target1/p)<fabs(target3/r))
                          {
                              
                                  printf("-1005-ture");
                              
                          }
                          else if(fabs(target1/p)<fabs(target2/q) && fabs(target2/q)>fabs(target3/r) && fabs(target1/p)>fabs(target3/r))
                          {
                              
                                  printf("-1006-ture");
                    
                          }
                          else if(fabs(target1/p)<fabs(target2/q) && fabs(target2/q)>fabs(target3/r) && fabs(target1/p)<fabs(target3/r))
                          {
                              
                                  printf("-1007-ture");
                              
                          }
                          else if(fabs(target1/p)<fabs(target2/q) && fabs(target2/q)<fabs(target3/r))
                          {
                              
                                  printf("-1008-ture");
                              
                          }
                      }
                      else
                        
                          if(fabs(target1/p)>fabs(target2/q) && fabs(target2/q)>fabs(target3/r))
                          {
                              
                                  printf("-1009-ture");
                              
                          }
                          else if(fabs(target1/p)>fabs(target2/q) && fabs(target2/q)<fabs(target3/r) && fabs(target1/p)>fabs(target3/r))
                          {
                              
                                  printf("-1010-ture");
                              
                          }
                          else if(fabs(target1/p)>fabs(target2/q) && fabs(target2/q)<fabs(target3/r) && fabs(target1/p)<fabs(target3/r))
                          {
                              
                                  printf("-1011-ture");
                              
                          }
                          else if(fabs(target1/p)<fabs(target2/q) && fabs(target2/q)>fabs(target3/r) && fabs(target1/p)>fabs(target3/r))
                          {
                              
                                  printf("-1012-ture");
                             
                          }
                          else if(fabs(target1/p)<fabs(target2/q) && fabs(target2/q)>fabs(target3/r) && fabs(target1/p)<fabs(target3/r))
                          {
                              
                                  printf("-1013-ture");
                              
                          }
                          else if(fabs(target1/p)<fabs(target2/q) && fabs(target2/q)<fabs(target3/r))
                          {
                              
                                  printf("-1014-ture");
                              
                          }
                     
                  }
                  else if(target1 == target2 == 0 && target3>0)
                  {
                      if(a>b)
                      {                           
                              if( target3/r>1)
                              {
                                  printf("-1015-");/*已修改1*/
                              }
                              else
                              
                                  printf("-1016-");/*已修改1*/
                              
                          
                      }
                      else
                                                
                              if(target3/r>1)
                              {
                                  printf("-1017-");/*已修改1*/
                              }
                              else
                              
                                  printf("-1018-");/*已修改1*/
                              
                       
                  }
                  else if(target1 == target2 == 0 && target3<0)
                  {
                      if(a>b)
                      {  
                          
                              if(fabs(target3/r)>1)
                              {
                                  printf("-1019-ture");
                              }
                              else
                              
                                  printf("-1020-ture");                          
                          
                      }
                      else
                                             
                              if(fabs(target3/r)>1)
                              {
                                  printf("-1021-ture");
                              }
                              else
                              
                                  printf("-1022-");/*已修改1*/
                                                            
                          
                     
                  }
               
                          }
             }
       }
       return 0;
}
      
搜索更多相关主题的帖子: 应用程序 include 控制台 
2016-03-04 00:34
快速回复:找了好久都不知道问题是什么else if运行混乱
数据加载中...
 
   



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

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