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.

Expert's answer

#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!

LATEST TUTORIALS
APPROVED BY CLIENTS