炉石抱歉歌原曲:请问我的程序哪里错了.

来源:百度文库 编辑:高考问答 时间:2024/05/03 03:32:02
#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;
}

#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;
}