Write a C statement that uses the manipulator setfill to out
Write a C++ statement that uses the manipulator setfill to output a line containing 35 stars, as in the following line:
int num = 1;
int i;
for (i = 0; i < 5; i++)
{
num = num * (5 - i);
cout << num << \" \";
}
cout << endl;
Solution
Hi,
Added the statement
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
int num = 1;
int i;
for (i = 0; i < 5; i++)
{
num = num * (5 - i);
cout<<setfill(\'*\')<<setw(35);
cout << num << endl;
}
cout << endl;
return 0;
}
Output:
**********************************5
*********************************20
*********************************60
********************************120
********************************120
