洛谷-P5705 【深基2.例7】数字反转

洛谷-P5705 【深基2.例7】数字反转

原题链接:https://www.luogu.com.cn/problem/P5705


题目描述

输入一个不小于 100 且小于 1000,同时包括小数点后一位的一个浮点数,例如123.4,要求把这个数字翻转过来,变成4.321并输出。

输入格式

输出格式

输入输出样例

输入 #1

123.4

输出 #1

4.321

C++代码

#include <iostream>
#include <cstring>
using namespace std;

int main() {
    string s;
    cin>>s;
    for(int i=s.size()-1;i>=0;--i)
        cout<<s[i];
    cout<<endl;
    return 0;
}
posted @ 2020-07-16 09:31  yuzec  阅读(1458)  评论(0编辑  收藏  举报