#include <iostream>
using namespace std;
int main()
{int x,y;
cin>>x;
if(x>=1)
{
y=x-1
;}
else y=-x+1;
cout<<"y="<<y<<endl;
return 0;
}
输出结果
学习总结 还行
#include <iostream>
using namespace std;
int main()
{int x,y;
cin>>x;
if(x>=1)
{
y=x-1
;}
else y=-x+1;
cout<<"y="<<y<<endl;
return 0;
}
输出结果
学习总结 还行