为什么我用scanf时n输入后总是0
#include <bits/stdc++.h>
using namespace std;
double n;
int t;
int main() {
scanf("%f %d",&n,&t);
printf("%.3f\n%d",n/t,2*t);
return 0;
}
但是用cin就好好的
#include <bits/stdc++.h>
using namespace std;
double n;
int t;
int main() {
cin>>n>>t;
cout<<setprecision(3)<<fixed<<n/t<<endl<<t*2;
return 0;
}
难道是人品问题???QAQ
求助各方大佬
谢谢了