Hi,
I have to display the details inside an array as a bar chart, the user has input the temperatures for the twelve months, here is the declaration and the user input:
int temp[12];
int menuChoice;
char month[12][5]={"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
and the user input:
for(int count=0;count<12;count++)
{
cout<<"Enter temp for "<<month[count]<<"=";
cin>> temp[count];
}
I want, somehow for the temperatures for each month to be displayed like a bar chart, for instance
Jan ***********
Feb ***** etc etc with a corresponding number for asterisks for the temperature.
Here's what I have so far
char graph = '*';
cout<<"Temperature bar chart";
for(int count=0;count<12;count++)
{
for(int b=0;b<int temp[count];b++)
{
cout<<graph;
}
cout<<endl;
}
Is that anywhere near what it should look like?
Any help would be great!
Thanks
Lenny