Ask Question

What is the output of the following program fragment? (alpha and beta are int variables and △ is a blank.) alpha = 2463; beta = 72; cout << "123456789" << endl << setw (5) << alpha << endl << setw (5) << beta << endl; A) 123456789 24630 72000 B) 123456789 △2463 72 C) 123456789 △2463 △△△ 72 D) 123456789 △2463 △△72 E) none of the above

+1
Answers (2)
  1. 12 September, 22:19
    0
    C. option is the answer.

    Explanation:

    First line print is straightforward. Second line introduces one blank (because of setw ()) before alpha value output. Third line puts 3 blanks before beta value output.

    123456789

    △2463

    △△△72

    setw () function sets field width. It is part of the iomanip library. Default justification is left, i. e. spaces or blanks start from the left.

    setw () can be inserted or extracted on input streams or output streams.
  2. 12 September, 22:26
    0
    Correct option is C if each output includes a new line which not shown in option I think that is typing mistake and output will be like this

    123456789

    2463

    72

    Explanation:

    C is correct option because it generate output like option C because the function setw sets width of output to 5 character so in alpha total characters are 4 so it print 4 characters after a blank space character and in beta total characters are 2 so it prints those 2 characters after printing three blank spaces;

    123456789

    2463

    72
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “What is the output of the following program fragment? (alpha and beta are int variables and △ is a blank.) alpha = 2463; beta = 72; cout ...” 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