c++小程序的问题
来源:百度知道 编辑:UC知道 时间:2024/09/13 02:14:41
#include(iostream)
using namespace std;
int main()
{
int x,y;
cout<<"input x,y";
cin>>x>>y;
if(x>y)
cout<<"x>y"<<endl;
else if(x=y)
cout<<"x=y"<<endl;
else cout<<"x<y"<<endl;
}
using namespace std;
int main()
{
int x,y;
cout<<"input x,y";
cin>>x>>y;
if(x>y)
cout<<"x>y"<<endl;
else if(x=y)
cout<<"x=y"<<endl;
else cout<<"x<y"<<endl;
}
#include(iostream) // 应该是 #include <iostream>
using namespace std;
int main()
{
int x,y;
cout<<"input x,y";
cin>>x>>y;
if(x>y)
cout<<"x>y"<<endl;
else if(x=y) //应该是 if (x==y)别写错成=
cout<<"x=y"<<endl;
else cout<<"x<y"<<endl;
//这里少了 return 0;
}
什么问题?
#include(iostream)
是<>不是括号
这才是最好的实现方式和书写板式:
#include <iostream>
using namespace std;
int main()
{
int x = 0;
int y = 0;
cout<<"input x,y";
cin>>x>>y;
if(x>y)
{
cout<<"x>y"<<endl;
}
else if( x < y )
{
cout<<"x<y"<<endl;
}
else
{
cout<<"x=y"<<endl;
}
return 0;
}
#include<iost