I need to display something that looks like:
     /
    -
    /
   /
    -
    /
   /
  /
   -
I currently have the following which does not print the slashes properly.
for (int i = 1; i <= numberOfDolls; i++) {
   for(int j = 1; j <= i; j++) 
      cout << setw(numberOfDolls) << '/' << endl;
      
      cout << "-" << endl;
    }
I was thinking of using setw() to increment the slashes. Is this possible?
I am not sure about your doubt but you will get desired output using following:
for (int i = 1; i <= numberOfDolls; i++) {
   for(int j = 1, n=numberOfDolls; j <= i; j++)
      cout << setw(n--) << '/' << endl;
      cout <<setw(numberOfDolls-1)<< "-" << endl;
    }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With