A PHP Error was encountered

Severity: 8192

Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated

Filename: libraries/Filtered_db.php

Line Number: 23

C++ program to demonstrate example of setw manipulator
Q:

C++ program to demonstrate example of setw manipulator

0

C++ program to demonstrate example of setw manipulator

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

setw manipulator program in C++

/*C++ program to demonstrate example of setw manipulator.*/
 
#include <iostream>
#include <iomanip>
using namespace std;
 
int main()
{
    char pName[3][30]={"Dove Soap","Colgate","Vim"};
    int  qty[3]  ={5,10,15};
    int  i;
     
    cout << setw(30) << "Product Name" << setw(20) << "Quantity" << endl;
    for(i=0; i< 3; i++){
        cout << setw(30) << pName[i] << setw(20) << qty[i] << endl;
    }
    return 0;
}

Output

                  Product Name            Quantity
                     Dove Soap                   5
                       Colgate                  10
                           Vim                  15

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now