P5705求助!

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

yeqiwei @ 2022-08-21 11:59:10

#include<iostream>
#include<cmath>
using namespace std;
int main()
{
    float a;
    int h,t,o,f;
    cin>>a;
    h=floor(a/100);
    t=floor(fmod(a,100)/10);
    o=floor(fmod(a,10));
    f=(a-100*h-10*t-o)*10;
    cout<<f<<"."<<o<<t<<h;
    return 0;
}

by JustinXiaoJunyang @ 2022-08-21 12:07:56

@yeqiwei 求关注~

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

int main()
{
    string s;
    cin >> s;
    int len = s.length();
    for (int i = len - 1; i >= 0; i--)
    {
        cout << s[i];
    }
    return 0;
}

by yeqiwei @ 2022-08-21 12:26:34

@JustinXiaoJunyang 感谢!


by huangyucong @ 2022-08-23 17:11:14

#include<iostream>
using namespace std;
int main()
{
float a;
int z,x,c,v,b;
cin>>a;
b=a*10;

v=b%10;
z=b/1000;
x=b/100;
x=x%10;
c=b/10;
c=c%100;
c=c%10;
b=v*1000+c*100+x*10+z;
a=b;
a=a/1000;
cout<<a;    
return 0;
}

by huangyucong @ 2022-08-23 17:12:13

求关注!!!!!!!!!!!!!!!!


by yeqiwei @ 2022-08-24 20:07:03

@huangyucong 谢谢!


by Flower_Bloom @ 2022-08-31 15:59:58

有没有一种可能他是在让你改代码


|