how do I get 'Additional' to line up with 'For $39.99'? I've tried \t and setw

36 Views Asked by At

how do I get width from the beginning of the new line so 'Additional' aligns right under 'For'?

char choice;

cout<<"Package A: For $39.99 per month, 4 gigabytes are provided.\n"
    <<setw(10)<<"Additional data costs $10 per gigabytes.";

return 0;
1

There are 1 best solutions below

0
Öö Tiib On

You can output empty string with width you desire. Like that:

std::cout << "Package A: For $39.99 per month, 4 gigabytes are provided.\n"
          << std::setw(11) << "" << "Additional data costs $10 per gigabytes.";