I want my output to look like a bar graph with the number of numbers in an array in each line.
My code is not working and I don't know why.
Code:void graph(int a[], int lo, int hi) { int x,y; for(y=(hi-1); y>=0; y--) { if(y%2==0) { cout<<setw(2)<<y<<"+"; } else { cout<<setw(2)<<" "<<"|"; } for(x=lo; x<hi; x++) { if(a[x]>=y) cout<<setw(2)<<"X"; else cout<<" "; } } }
It doesn't look like a graph at all. Please help.
I want it to look like the graph here p11.html
This is just my function prototype
Thanks



LinkBack URL
About LinkBacks


