这段程序怎么老报错?哪里出了问题呢?

来源:百度知道 编辑:UC知道 时间:2024/05/29 18:50:30
#include<iostream.h>
void 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;

}

这段代码毛病很多啊!
我帮你改正了,你对照着看吧!
#include<iostream>
using namespace std;
void main()
{
int X,Y;
cout<<"Enter X and Y ";
cin>>X>>Y;
if (X>Y)
cout<<"X>Y"<<endl;
else if(X<Y)
cout<<"X<Y"<<endl;
else
cout<<"X=Y"<<endl;
}
注意开头,还有就是大小写,还有f语句的地方.

#include<iostream.h>
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;
}

#include<iostream.h>
void main()
{
int X,Y;
cout<<"Enter X and Y";
cin>>X>>Y;
if (X!=Y);