#include<iostream>
using namespace std;
int main()
{
double x,y;
char z;
z=(x>-2&&x<2&&y>-2&&y<2)?false:true;
cout<<"输入横坐标x和纵坐标y"<<endl;
cin>>x>>y;
cout<<"该点的坐标是("<<x<<","<<y<<")"<<endl;
cout<<z<<endl;
return 0;
}
z是char,不能存false和true
而且给z赋值的时候,x y还没有输入
兄弟由ascii值造成的
#include<iostream>
using namespace std;
int main()
{
double x=0, y=0;
bool z;
cout << "输入横坐标x和纵坐标y" << endl;
cin >> x >> y;
z = (x>-2 && x<2&&y>-2 && y < 2) ? true : false;
cout << "该点的坐标是(" << x << "," << y << ")" << endl;
cout << z << endl;
return 0;
}