Rose_ @ 2022-11-18 09:26:13
#include<stdio.h>
int main(void)
{
int a, b, c[4],i=0;
while(1)//循环确定输入范围在【100,1000)内
{
scanf_s("%d.%d", &a,&b);
if ((a >= 100) && (a < 1000) && (b != 0))
{
break;
}
}
printf("%d", b);
while (a!=0)
{
if (i == 2)
{
printf(".");
i++;
continue;
}
c[i] = a % 10;
a = a / 10;
printf("%d", c[i]);
i++;
}
return 0;
}
by xvl_ @ 2022-11-18 09:33:38
@Rose_
其实不用那么麻烦
#include<bits/stdc++.h>
using namespace std;
int main() {
char a, b, c, d;
scanf("%c%c%c.%c", &a, &b, &c, &d);
printf("%c.%c%c%c", d, c, b, a);
return 0;
}
by xvl_ @ 2022-11-18 09:34:24
@Rose_
而且你为什么要确定
by Rose_ @ 2022-11-18 12:23:43
@xvl_ 确保输入的数据是题目要求的范围内嘛..
by xvl_ @ 2022-11-18 14:31:04
@Rose_
题目的意思是说输入的数一定是在这个范围内……
by Rose_ @ 2022-11-18 17:01:31
@xvl_ ...