C++NO1
2024-11-10 14:17:37
发布于:云南
1阅读
0回复
0点赞
#include<bits/stdc++.h>
using namespace std;
int main(){
double n,ans; cin >> n;
string s; cin >> s;
if(s == "in") ans = 2.54 * n;
else{
if(n != 0 && s == "cm") ans = n / 2.54;
else{
cout << "error";
return 0;
}
}
printf("%.2lf",ans);
if(s == "in") cout << " cm";
else cout << " in";
return 0;
}
这里空空如也
有帮助,赞一个