朱志明生态养殖林蛙:请问我的程序哪里错了.
来源:百度文库 编辑:中科新闻网 时间:2024/05/15 10:15:56
#include <iostream>
using namespace std;
int main()
{
cout<<"enter x and y:";
cin>>x>>y;
if(x!=y)
if(x>y)
cout<<"x>y"<<endl;
else
cout<<"x<y"<<endl;
else
cout<<"x=y"<<endl;
}
using namespace std;
int main()
{
cout<<"enter x and y:";
cin>>x>>y;
if(x!=y)
if(x>y)
cout<<"x>y"<<endl;
else
cout<<"x<y"<<endl;
else
cout<<"x=y"<<endl;
}
#include <iostream>
using namespace std;
int main()
{
int x,y;
cout<<"enter x and y:";
cin>>x>>y;
if(x!=y)
if(x>y)
cout<<"x>y"<<endl;
else
cout<<"x<y"<<endl;
else
cout<<"x=y"<<endl;
}
你再试试
x,y还没声明呢
int x,y;
#include <iostream>
using namespace std;
int main()
{
int x,y;
cout<<"enter x and y:";
cin>>x>>y;
if(x!=y)
{
if(x>y)
cout<<"x>y"<<endl;
else
cout<<"x<y"<<endl;
}
else
cout<<"x=y"<<endl;
return 0;
}