LonelyFish @ 2016-12-13 20:19:57
#include<iostream>
#include<fstream>
using namespace std;
ifstream in("reverse.in");
ofstream out("reverse.out");
int main()
{
string n;
int l,j;
cin>>n;
l=n.length();
j=l-1;
for(int i=0;i<=l-1;i++)
{
if(i==0&&n[0]=='-')
{
cout<<"-";
continue;
}
cout<<n[j];
j--;
}
in.close();
out.close();
return 0;
}
by CodyQ666 @ 2017-01-18 12:00:35
#include<iostream>
#include<fstream>
using namespace std;
//ifstream in("reverse.in");//不用文件输入输出
//ofstream out("reverse.out");//不用文件输入输出
int main()
{
string n;
int l,j;
cin>>n;
l=n.length();
j=l-1;
for(int i=0;i<=l-1;i++)
{
if(i==0&&n[0]=='-')
{
cout<<"-";
continue;
}
cout<<n[j];
j--;
}
//in.close();//不用文件输入输出
//out.close();//同上
return 0;
}
/*我AC了,程序不错*/