找了好久都不知道问题是什么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;
}