</pre><pre code_snippet_id="1621901" snippet_file_name="blog_20160324_1_5778469" name="code" class="cpp">#include <iostream>
using namespace std;
int main()
{
int x,y;
cin>>x;
if(x>=1)
y=x-1;
else y=-x+1;
cout<<y<<endl;
}
第一个
#include <iostream>
using namespace std;
int main()
{
int w,h,s;
cin>>w>>h;
s=h-100;
if(w>s*1.2)
cout<<"超重:"<<endl;
else
{
if(w<s*0.8)
cout<<"超轻:"<<endl;
else cout<<"正常:"<<endl;
}
return 0;
}
第三个
#include <iostream>
#include <Cmath>
using namespace std;
int main()
{
double x1,y1,x2,y2,d;
cin>>x1>>y1>>x2>>y2;
d=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
cout<<d<<endl;
return 0;
}