Create a C program to make a simple bar chart Have the user

Create a C++ program to make a simple bar chart. Have the user input the production level of two plants in whole thousands and assume only integer inputs. Output “bars” that represents the production level in each plant, similar to that shown below,

Solution

#include <iostream>
using namespace std;

int main() {
  
   int plant1,plant2;
  
   cout<<\"what is the production of plant 1? (000\'s)\ \";
   cin>>plant1;
   cout<<\"what is the production of plant 2? (000\'s)\ \";
   cin>>plant2;
  
   cout<<\"\ \ \ \\t\\t\\t\"<<\"production (000\'s)\";
   cout<<\"\ \\t\\t 0   1   2   3   4   5   6   7   8   9\"
        <<\"\ \\t\\t |---|---|---|---|---|---|---|---|---|\";
      
   cout<<\"\ Plant 1 :*\";
   for(int i=1;i<=plant1;i++)
   {
        cout<<\"****\";          //for loop to print quantity on bar (1 bar= 4 *\'s )
   }
   cout<<\"\ Plant 2 :*\";
   for(int i=1;i<=plant2;i++)
   {
        cout<<\"****\";
   }
   return 0;
}

Create a C++ program to make a simple bar chart. Have the user input the production level of two plants in whole thousands and assume only integer inputs. Outpu

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site