row and columns

how do i put my value in 5 columns, that 10 values in each sides separate

#include<iostream>
#include<iomanip>
#include<cmath>

using namespace std;

int main(){
double a;
int i,j,k;


cout<<"Enter the starting value";
cin>>a;


cout<<" the number of columns to be generated in the table is 5:"<<endl;

for(i=0;i<10;i++){
for(j=0;j<5;j++){
cout<<setw(18)<<"|";
}
cout<<endl;
}

for(k=0;k<50;k++){
a=a+1.00;
cout<<fixed<<setprecision(2)<<a<<endl;
}

return 0;
}

Something like this?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// how do i put my value in 5 columns, that 10 values in each sides separate
#include <cmath>
#include <iomanip>
#include <iostream>

int main()
{
    std::cout << "Enter the starting value: ";
    double a = 0.0;
    std::cin >> a;
    std::cout << "The number of columns to be generated in the table is 5:\n";

    for(int i=0; i<10; i++) {
        for(int j=0; j<5; j++) {
            std::cout << '|' << std::fixed << std::setprecision(2) 
                      << std::setw(7) << a+j*10 << std::setw(3);
        }
        std::cout << '\n';
        a++;
    }

    return 0;
}


Enter the starting value: 1
The number of columns to be generated in the table is 5:
|   1.00  |  11.00  |  21.00  |  31.00  |  41.00
|   2.00  |  12.00  |  22.00  |  32.00  |  42.00
|   3.00  |  13.00  |  23.00  |  33.00  |  43.00
|   4.00  |  14.00  |  24.00  |  34.00  |  44.00
|   5.00  |  15.00  |  25.00  |  35.00  |  45.00
|   6.00  |  16.00  |  26.00  |  36.00  |  46.00
|   7.00  |  17.00  |  27.00  |  37.00  |  47.00
|   8.00  |  18.00  |  28.00  |  38.00  |  48.00
|   9.00  |  19.00  |  29.00  |  39.00  |  49.00
|  10.00  |  20.00  |  30.00  |  40.00  |  50.00

thks
Topic archived. No new replies allowed.