Format your output.
Code:
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
float X[11],XSub[11];
int i=0,j=0;
X[0]=-1;
for (i=0;i<10;i++)
{
X[i+1]=X[i]-(- 0.2);
XSub[0]=X[i];
cout.setf(ios::fixed,ios::floatfield); // You need these flags
cout.setf(ios::showpoint); // for floats to read properly
cout << setprecision(2);
cout << "interval " << X[i] << " " <<X [i+1] <<endl;
for (j=0;j<11;j++)
{
XSub[j+1]=XSub[j]-(-0.02) ;
cout<<XSub[j]<<" ";
}
cout<<endl;
}
cin.get();
return 0;
}
Sample Output:
Code:
interval -1.00 -0.80
-1.00 -0.98 -0.96 -0.94 -0.92 -0.90 -0.88 -0.86 -0.84 -0.82 -0.80
interval -0.80 -0.60
-0.80 -0.78 -0.76 -0.74 -0.72 -0.70 -0.68 -0.66 -0.64 -0.62 -0.60
interval -0.60 -0.40
-0.60 -0.58 -0.56 -0.54 -0.52 -0.50 -0.48 -0.46 -0.44 -0.42 -0.40
interval -0.40 -0.20
-0.40 -0.38 -0.36 -0.34 -0.32 -0.30 -0.28 -0.26 -0.24 -0.22 -0.20
interval -0.20 -0.00
-0.20 -0.18 -0.16 -0.14 -0.12 -0.10 -0.08 -0.06 -0.04 -0.02 -0.00
interval -0.00 0.20
-0.00 0.02 0.04 0.06 0.08 0.10 0.12 0.14 0.16 0.18 0.20
interval 0.20 0.40
0.20 0.22 0.24 0.26 0.28 0.30 0.32 0.34 0.36 0.38 0.40
interval 0.40 0.60
0.40 0.42 0.44 0.46 0.48 0.50 0.52 0.54 0.56 0.58 0.60
interval 0.60 0.80
0.60 0.62 0.64 0.66 0.68 0.70 0.72 0.74 0.76 0.78 0.80
interval 0.80 1.00
0.80 0.82 0.84 0.86 0.88 0.90 0.92 0.94 0.96 0.98 1.00