formatted input
#include <iostream>
#include<iomanip>
using namespace std;
int main() {
// Write C++ code here
float a=12.33214;
cout<<a<<endl;
cout<<fixed<<setprecision(2)<<a<<endl;
// int b;
// float sal;
// scanf("%d %f",&b,&sal);
// printf("%7d",b);
// cout<<setw(7)<<fixed<<setprecision(2)<<sal<<endl;
// cout << "Start small. Ship something.";
// cout<<setfill("#")<<setw(7)<<23<<endl;
// cout<<setfill('#')<<setw(7)<<23<<endl;
cout<<left<<setw(3)<<"Hi";
cout<<right<<setw(20)<<"their";
return 0;
}
Comments
Post a Comment