Question

the cout<<setw(5) will the force the program to display 5 significant digits of output

the cout<<setw(5) will the force the program to display 5 significant digits of output

0 0
Add a comment Improve this question Transcribed image text
Answer #1
#include <iostream>
#include <iomanip>
using namespace std;

int main() {
    cout << setfill('0') << setw(5) << true << endl;
    cout << setfill('0') << setw(5) << false << endl;
    return 0;
}
Add a comment
Know the answer?
Add Answer to:
the cout<<setw(5) will the force the program to display 5 significant digits of output
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • I did a program in computer science c++. It worked fine the first and second time...

    I did a program in computer science c++. It worked fine the first and second time when I ran the program, but suddenly it gave me an error. Then, after a few minutes, it started to run again and then the error showed up again. This is due tonight but I do not know what is wrong with it. PLEASE HELP ME! Also, the instruction for the assignment, the code, and the error that occurred in the program are below....

  • Write a program that prints to cout, separated by a space, the digits of any positive...

    Write a program that prints to cout, separated by a space, the digits of any positive three digit integer. You will need one variable, named, for example, value, for the number (int value) to be broken down into its digits. You might also need other variables to store the digits as you get them. This is c++. Cant use loops, if else statements etc.

  • 5. (7 pts) What wil display on the output screen after following program is executed? includeciostream...

    5. (7 pts) What wil display on the output screen after following program is executed? includeciostream using namespace std int b 40 int A function(int a) int main (void) int c 7, b 15 cout<cA function (e) <cendla return 6 int A function (int a) int i cout<<b<<endl; if (a>-0) else return i i-ai i--ai Ans5 6. (7 pts) Show what will appear on the output screen after the following program is executed tincludeciostream> using namespace std; void A function...

  • What is the output of the following program? int main(void) { int x, y, z; x...

    What is the output of the following program? int main(void) { int x, y, z; x = 5; y= test(x); z= x + y; cout<< setw(4)<<x <<” + “<<setw(4)<<y<<”=” << setw(4)<<z<<endl; return 0; } int test (int x) { int w; w = x + 10; return (w); }

  • The objective of this project is to provide experience working with user interface menus and programmed...

    The objective of this project is to provide experience working with user interface menus and programmed decision making. Modify the C++ source you created in Project # 2 to incorporate the following requirements: 1. Present a menu to the user which includes: a. Enter checking account transaction b. Enter savings account transaction c. Quit 2. If the user selects a., request the checking account balance, the checking account transaction date, the checking account description, and the checking account amount from...

  • Using a single cout statement, write a c++ program to produce the following output. "#//'Baton //...

    Using a single cout statement, write a c++ program to produce the following output. "#//'Baton // @ \\ Rouge'\\#" Write a c++ program, using one cout statement that will output the following: ”\%”BEARS”/%”

  • Need done in C++ Can not get my code to properly display output. Instructions below. The...

    Need done in C++ Can not get my code to properly display output. Instructions below. The code compiles but output is very off. Write a program that scores the following data about a soccer player in a structure:            Player’s Name            Player’s Number            Points Scored by Player      The program should keep an array of 12 of these structures. Each element is for a different player on a team. When the program runs, it should ask the user...

  • What is the output from each of the following segments of C++ code? Record the output...

    What is the output from each of the following segments of C++ code? Record the output after the “Answer” prompt at the end of each program fragment. Assume all variables have been suitably declared. (Each problem is worth 3 points.) 1. for (int j = 25; j > 16; j -= 3)        cout << setw(5) << j;     Answer: 2. int sum = 0;       for (int k = -2; k <= 2; k++)         sum = sum +...

  • Fix all syntax and logical errors for the following program. Please generate the correct output. //...

    Fix all syntax and logical errors for the following program. Please generate the correct output. // Program Typos prints three integer numbers, sums the numbers, calculates // the average, and prints the sum and the average of the three numbers. #Include #Include using namespace std; const ONE = 5; const TWO = 6; const THREE = 7; int Main () int sum; float average; cout << fixed << showpoint; c0ut << SetW(5) << ONE << TWO << THREE << end1;...

  • C++ Redo PROG8, a previous program using functions and/or arrays. Complete as many levels as you...

    C++ Redo PROG8, a previous program using functions and/or arrays. Complete as many levels as you can. Level 1: (20 points) Write FUNCTIONS for each of the following: a) Validate #students, #scores. b) Compute letter grade based on average. c) Display student letter grade. d) Display course average. Level 2: (15 points) Use ARRAYS for each of the following. e) Read a student's scores into array. f) Calculate the student's average based on scores in array. g) Display the student's...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT