Answer to Question #313419 in C++ for Azam

Question #313419

Write a program that takes five integer numbers (range 0 to 10). And display horizontal



bar chart. Do not use loops. You can use <iomanip> header file for printing bar chat.

1
Expert's answer
2022-03-17T17:10:13-0400
#include <iostream>
#include <iomanip>
using namespace std;


int main() {
    int x1, x2, x3, x4, x5;


    cin >> x1 >> x2 >> x3 >> x4 >> x5;
    cout << setfill('*') << setw(x1+1) << '\n';
    cout << setfill('*') << setw(x2+1) << '\n';
    cout << setfill('*') << setw(x3+1) << '\n';
    cout << setfill('*') << setw(x4+1) << '\n';
    cout << setfill('*') << setw(x5+1) << '\n';


    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment