#include <iostream>
using namespace std;
int main( ) {
const int NUMSTORE = 5 ;
int sales[ NUMSTORE] ;
for ( int i = 0 ; i < NUMSTORE ; ++ i) {
cout << "Enter today's sales for store " << ( i + 1 ) << ": " ;
cin >> sales[ i] ;
while ( sales [ i] < 0 ) {
cout << "Sales cannot be negative. Please enter again: " ;
cin >> sales[ i] ;
}
cout << "\n SALES BAR CHART\n (Each * = $100)\n " ;
for ( int i = 0 ; i < NUMSTORE; ++ i ) {
cout << "Store " << ( i + 1 ) << ": " ;
int numStars = sales[ i] / 100 ;
for ( int j = 0 ; j < numStars; ++ j) {
cout << "* " ;
}
cout << endl;
}
return 0 ;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKSB7CgkKCWNvbnN0IGludCBOVU1TVE9SRSA9IDU7CglpbnQgc2FsZXNbTlVNU1RPUkVdOwoJCglmb3IgKCBpbnQgaSA9IDA7IGkgPCBOVU1TVE9SRSA7ICsraSl7CgkJY291dCA8PCAiRW50ZXIgdG9kYXkncyBzYWxlcyBmb3Igc3RvcmUgIiA8PCAoaSArIDEpIDw8ICI6ICI7CiAgICAgICAgY2luID4+IHNhbGVzW2ldOyAKICAgICAgICAKICAgICAgICB3aGlsZSAoIHNhbGVzIFtpXSA8IDAgKXsKICAgICAgICAJCiAgICAgICAgCWNvdXQgPDwgIlNhbGVzIGNhbm5vdCBiZSBuZWdhdGl2ZS4gUGxlYXNlIGVudGVyIGFnYWluOiAiOwogICAgICAgICAgICBjaW4gPj4gc2FsZXNbaV07IAogICAgICAgIH0KICAgICAgICAKICAgICAgICBjb3V0IDw8ICJcblNBTEVTIEJBUiBDSEFSVFxuKEVhY2ggKiA9ICQxMDApXG4iOwogICAgICAgIAogICAgICAgIGZvciAoIGludCBpID0gMDsgaSA8IE5VTVNUT1JFOyArK2kgKXsgCiAgICAgICAgCQogICAgICAgIAljb3V0IDw8ICJTdG9yZSAiIDw8IChpICsgMSkgPDwgIjogIjsKICAgICAgICAJCiAgICAgICAgCSBpbnQgbnVtU3RhcnMgPSBzYWxlc1tpXSAvIDEwMDsgCiAgICAgICAgCSBmb3IgKCBpbnQgaiA9IDA7IGogPCBudW1TdGFyczsgKytqKXsgCiAgICAgICAgCSAJY291dCA8PCAiKiAiOwogICAgICAgIAkgfQogICAgICAgIGNvdXQgPDwgZW5kbDsKICAgICAgICAJCiAgICAgICAgCiAgICAgICAgCiAgICAgICAgCgl9CgoKCgoKCgoKCglyZXR1cm4gMDsKfQ==