Ask Question
12 December, 07:03

Write a cout statement that uses the setw manipulator to display the number variable with a field width of 4. Do not use an endl manipulator in your statement. (Assume the program includes the necessary header file for the setw manipulator.)

+1
Answers (1)
  1. 12 December, 07:09
    0
    Following are the statement in C+ + Programming language

    cout<
    cout<
    Explanation:

    The setw () is setting according to the width defined as the argument to the function. The setw () is under the ios header library. It means its definition is under the ios header file.

    Following are the syntax to defined the setw () function that are given below

    setw (int k)

    For example

    include / / header file

    #include / / header file

    #include / / header file

    using namespace std; / / namespace

    int main () / / main function

    {

    int number = 60; / / variable declaration

    cout << "previous width:" << number; / / print

    cout << " After setting the width"<< setw (4);

    cout << number; / / display number

    return 0;

    }
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Write a cout statement that uses the setw manipulator to display the number variable with a field width of 4. Do not use an endl ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers