How do these 2 ways of printing floats with decimal part differs?
#include <iostream>
using namespace std;
int main() {
float n;
cin >> n;
printf("%.2f,n);
}
#include <iostream>
using namespace std;
int main() {
float n;
cin >> n;
printf("%.*f,2,n);
}
Aucun commentaire:
Enregistrer un commentaire