left and right justification

I am having trouble with left and right aligning my output for a project I am doing in a programming class. I have several lines of code that is meant to have an output where separate columns of numbers and words need to be justified either left or right. Here is some code from my program:

1
2
3
4
5
6
7
8
cout << setw(3) << "" << qtyLemonade << setw(3) << "" << "Lemonade" 
    << setw(15) << "" << "$" << setw(1) << "" << LEMONADE_PRICE << setw(12) 
    << "$" << setw(1) << "" << totalLemonade << endl;

cout << setw(3) << "" << qtyIcee << setw(3) << "" << "ICEE" 
    << setw(19) << "" << "$" << setw(1) << "" << ICEE_PRICE << setw(12) 
    << "$" << setw(1) << "" << totalIcee << endl;
    


and my desired output is(using arbitrary numbers):

 50      Lemonade       $ 1.11       $  11.11
123      ICEE           $ 1.11       $ 111.11


I have read about setiosflags(ios::left) and resetiosflags(ios::left) but implementing them has brought about no change in my program. So my main question is how would i go about setting a right justification for the first, third, and fourth columns while keeping the second column left justified?

If I am leaving any information out let me know and I will provide it.

Topic archived. No new replies allowed.