本题要求编写程序,顺序读入浮点数1、整数、字符、浮点数2,再按照字符、整数、浮点数1、浮点数2的顺序输出。
时间: 2023-04-30 10:02:14 浏览: 127
请使用相应语言(如C++, Python等)编写程序,实现以下功能:
- 顺序读入一个浮点数1、一个整数、一个字符、一个浮点数2
- 按照字符、整数、浮点数1、浮点数2的顺序输出
例如:
```
输入:3.14 15 'a' 2.71
输出:a 15 3.14 2.71
```
相关问题
本题要求编写程序,顺序读入浮点数1、整数、字符、浮点数2,再按照字符、整数、浮点数1、浮点数2的顺序输出
好的,以下是程序的代码:
```python
f1 = float(input()) # 读入浮点数1
i = int(input()) # 读入整数
c = input() # 读入字符
f2 = float(input()) # 读入浮点数2
# 按照要求输出
print(c, i, f1, f2)
```
这个程序首先按照顺序读入了四个变量:浮点数1、整数、字符、浮点数2。然后,根据题目要求,按照字符、整数、浮点数1、浮点数2的顺序输出这四个变量。输出时,我们使用了 `print()` 函数,并将四个变量以逗号分隔的形式传递给它,这样它就会按照给定的顺序输出它们了。
希望这个程序能够帮到你!
顺序读入浮点数1、整数 字符 浮点数二 再按照字符整数浮点数1浮点数2的顺序输出
代码如下:
```python
f1 = float(input()) # 读入浮点数1
i1 = int(input()) # 读入整数
c = input() # 读入字符
f2 = float(input()) # 读入浮点数2
print(c, i1, f1, f2) # 按照字符整数浮点数1浮点数2的顺序输出
```
输入示例:
```
3.14
42
A
2.718
```
输出示例:
```
A 42 3.14 2.718
```
相关推荐
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)