我想在程序里面加一个显示字母的函数,应该怎么表达啊??
#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 target1,target2,target3,,variable3,variable1,variable2,;
float findMax(float,float);
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");
target1=C1-O1;
target2=C2-O2;
target3=C3-O3;
variable1= (L3-L2)-(-1*(pow((L3-L2),fabs(k-j))*fabs(k-j)));
variable2= 2*(target3/fabs(target3))*(target2/fabs(target2))*target2;
variable3= fabs(variable1 + variable2)-9;
if(L1<L2 && L2<L3 )/*End of 2910*/ //第一个
{
printf("-1001-ture,%.f,%.1f距量,\n %.0f价量",variable3,);/*已修改1*/
}
else
{
printf("-1001-ture,%.f,%.1f距量,\n %.0f价量,variable3,);/*已修改1*/
}
return 0
}
现在printf里variable3显示的是数字嘛,我想改为variable3>1就显示TURE,<1就显示false,那应该怎么改啊??谢谢