long double: Formatting includes precision, width, alignment, and format of large numbers.
#include <iostream>
#include <iomanip>
using namespace std;
int main(){
long double number,factorial;
number=1.0;
factorial=1.0;
cout.precision(0); // no decimal point
cout.setf(ios::left); // left justify numbers
cout.setf(ios::fixed); // use fixed format
for(int i=0;i<25;i++) {
factorial*=number;
number=number+1.0;
cout.width(30); // width of 30 characters
cout << factorial << endl;
}
return (0);
}
Related examples in the same category