| | |
Bar Graph Formatting
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Sep 2009
Posts: 5
Reputation:
Solved Threads: 0
Hi there.
I am producing a bar graph which uses values from a array.
I have tried many different ways of getting a fixed size bar graph.
Currently it prints the graph correctly with bars both above and below the x axis it also prints the reverse if the user inputted value is negative.
The problem i have is that at the moment if the user enters a large value say 100 the graph step down 100 lines to the x axis making the graph over 100 lines big (as negative bar graph is also included).
I have tried to use an equation inside the main for loop however it plays up with the graph.
Thanks for your sugesstions.
double array1[61];
double val1;
int q;
double input;
double array1[61];
double val1;
int q;
double input;
I am producing a bar graph which uses values from a array.
I have tried many different ways of getting a fixed size bar graph.
Currently it prints the graph correctly with bars both above and below the x axis it also prints the reverse if the user inputted value is negative.
The problem i have is that at the moment if the user enters a large value say 100 the graph step down 100 lines to the x axis making the graph over 100 lines big (as negative bar graph is also included).
I have tried to use an equation inside the main for loop however it plays up with the graph.
Thanks for your sugesstions.
double array1[61];
double val1;
int q;
double input;
double array1[61];
double val1;
int q;
double input;
C++ Syntax (Toggle Plain Text)
for (val1 = 50; val1 >= 0; val1--) { cout << setw(6) << input--; for (q = 0; q <= 60; q++) { if (array1[q] >= val1) { cout << "#"; } else { cout << " "; } } cout << endl; } for (val1 = 0; val1 >= -50; val1--) { cout << setw(6) << input--; for (q = 0; q <= 60; q++) { if (array1[q] >= val1) { cout << " "; } else { cout << "#"; } } cout << endl; } cout << endl; }
![]() |
Similar Threads
- How to create a pai chart or bar graph from a table data in java ?? (Java)
- VB 2008 Bar Graph (VB.NET)
- Pie chart or Bar Graph (VB.NET)
- Dice rolls bar graph (Java)
- Simple Bar Graph (Python)
- Code Snippet: Draw a Bar Graph (Python) (Python)
- bar graph & _POST variables (PHP)
Other Threads in the C++ Forum
- Previous Thread: VTK Installation on VS2008
- Next Thread: Huffman codes creation problem
| Thread Tools | Search this Thread |
api array based binary bitmap c++ c/c++ calculator char char* class classes code coding compile console conversion count database delete deploy desktop developer directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp iamthwee ifstream input int java lib linkedlist linker linux list loop looping loops map math matrix memory multiple news node number numbertoword output pointer problem program programming project python random read recursion recursive reference return rpg sorting string strings temperature template templates test text text-file tree unix url variable vector video visualstudio win32 windows winsock word wordfrequency wxwidgets






