0
已解决
邵悦媛
新手光能
新手光能
将分数\frac{a}{b}ba转化为小数,保留到小数点后两位。
输入描述 Input Description
两个整数,a b,表示分数b分之a
输出描述 Output Description
分数的小数结果
样例输入 Sample Input
1 2
样例输出 Sample Output
0.50
//5487
打印下图所示的三角形。
输入描述 Input Description
无
输出描述 Output Description
一个三角形
样例输入 Sample Input
无
样例输出 Sample Output
________
\ /
\ /
\ /
\/
怎么做?
#include<iostream>
#include<cmath>
#include<cstdio>
#include<string>
#include<cstring>
#include<algorithm>
using namespace std;
int main(){
freopen("decimal.in","r",stdin);
freopen("decimal.out","w",stdout);
double a,b,x;
cin>>a>>b;
x=b/a;
printf("%.2f",x*1.0);
fclose(stdin);
fclose(stdout);
return 0;
}
//5487
#include<iostream>
#include<cmath>
#include<cstdio>
#include<string>
#include<cstring>
#include<algorithm>
using namespace std;
int main(){
freopen("triangle.in","r",stdin);
freopen("triangle.out","w",stdout);
cout<<"________"<<endl;
cout<<"\ "<<"/ "<<endl;
cout<<" \ "<<"/"<<endl;
cout<<" \ "<<"/"<<endl;
cout<<" \/";
fclose(stdin);
fclose(stdout);
return 0;
}
//5485
怎么做?
PS:把freopen和fclose加一个//就可以运行了