From a8aa466476aca086f77e54a2cdbaa9b66cd650be Mon Sep 17 00:00:00 2001 From: Shane1026 Date: Fri, 25 Oct 2019 18:56:07 +0530 Subject: [PATCH] Added a code to print a bar braph --- bar_graph.cpp | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 bar_graph.cpp diff --git a/bar_graph.cpp b/bar_graph.cpp new file mode 100644 index 0000000..4837d97 --- /dev/null +++ b/bar_graph.cpp @@ -0,0 +1,65 @@ +#include + +using namespace std; + +void plot(int ar[], int n) +{ + int highest=0; + for(int i=0; ihighest) + highest=ar[i]; + } + cout< 0;c--) + { + if(highest<10) + { + cout<<"\t\t"; + cout<<" "<=highest) + cout<<"|##|\t"; + } + + highest--; + cout<0;k--) + cout<<"________"; + cout<>n; + int ar[n]; + + for(int i=0; i>ar[i]; + + } + plot(ar,n); +}