Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a C++ statement that uses the manipulator \'setfill\' to output a line con

ID: 3545725 • Letter: W

Question

Write a C++ statement that uses the manipulator 'setfill' to output a line containing 35 asterisk characters.

Here is the answer that I was given by a user on here


#include <iomanip>

cout<<setfill("*")<<setw(35)<<" ";



But I think it should be what I have below except my instructor says that I am missing something

#include <iomanip>

cout<<setfill("*")<<setw(35)<<"/n";



Why is it <<" "; and not <<"/n";


My instructor is saying that there is something missing between setw(35)<< and "

Explanation / Answer

is the new line character,

Maybe you can try this:

cout<<setfill('*')<<setw(35)<<'*'<<" ";


Note, setfill cannot use double quotation marks, must use single

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote