How does the setw() work exactly?

I thought that for every number you have inside the parenthesis, it would indent the text by one space. The code below shows the spaces that I'm trying to add before, in between, and after the text. I'm trying to be exact on the number of spaces that is shown below. So I'm wondering, how can I use the setw() to add the exact number of spaces that I need?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
    cout << "\n";
    cout << setw(24);
    cout << "Salsa Sales Report " << "\n";
    cout << "\n";
    cout << "Name              Jars Sold " << "\n";
    cout << "____________________________" << "\n";
    cout << "mild                      " << jarsSold[0] << "\n";
    cout << "medium                    " << jarsSold[1] << "\n";
    cout << "sweet                     " << jarsSold[2] << "\n";
    cout << "hot                       " << jarsSold[3] << "\n";
    cout << "zesty                     " << jarsSold[4] << "\n";
    cout << "\n";
    cout << "Total Sales:             "  << total << "\n";
    cout << "High Seller: " << HighSeller << " " <<"\n";
    cout << "Low Seller : " << LowSeller << " " <<"\n";
Topic archived. No new replies allowed.