> For the complete documentation index, see [llms.txt](https://blog.mcyou.cc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://blog.mcyou.cc/c++-mei-ri-yi-ti/c++-mei-ri-yi-ti-day-2-shu-zi-fan-zhuan.md).

# C++每日一题 Day 2 数字反转

***

lhy版权所有，禁止转载

### 知识点：输入输出，char类与string类

***

### 本题提示：先尝试用自己能想到的方法做，如果还是不会则查看回答要求内的提示。

## 题目描述

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

## 输入

一行一个浮点数

## 输出

一行一个浮点数

## 输入输出样例

**输入**

```
123.4
```

**输出**

```
4.321
```

***

## 回答要求

* 附上你完成本程序的完整代码
* 你是否使用char类型来储存数据来做本题？如果不是，尝试一下（不一定要写出来）。

  思路：每个数字或`.`是否是一个字符？这五个数字（字符）一定要视为一个整体来处理吗？
* 什么是char类型？有什么用？能够储存什么？
* 拓展：c++中引入了新的一种类型字符串（string），尝试用String储存数据重新完成本题。（可能需要一些数组的知识，可以不做）


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://blog.mcyou.cc/c++-mei-ri-yi-ti/c++-mei-ri-yi-ti-day-2-shu-zi-fan-zhuan.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
