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.
#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;
}
Comments
Leave a comment