Hello, I've tried the problem and I'm not geeting anywhere, please provide c++ code, and output. Thank you Write a program to create a bar chart showing the average monthly mean temperature for College Station from 2004 to 2013. The point of the exercise is to compute the size and location of the rectangles rather than explicitly hardcode that information. This means thinking about scale and offsets. The data is: 2013 48.3 deg F 2012 58.1 2011 54.5 2010 47.1 2009 51.1 2008 50.9 2007 55.5 2006 55.2 2005 49.5 2004 56.9 Put it in an initializer list (use vector). Note that a good graphic will have the bars for each year clearly separated and a better graphic will have the tick mark for the year aligned with the center of the bar for that year.
c++ code:
#include <bits/stdc++.h>
using namespace std;
int main()
{
vector<float> v(10);
v[0] = 56.9;//Entry for 2004
v[1] = 49.5;//Entry for 2005
v[2] = 55.2;//Entry for 2006
v[3] = 55.5;//Entry for 2007
v[4] = 50.9;//Entry for 2008
v[5] = 51.1;//Entry for 2009
v[6] = 47.1;//Entry for 2010
v[7] = 54.5;//Entry for 2011
v[8] = 58.1;//Entry for 2012
v[9] = 48.3;//Entry for 2013
cout << "Year" << "\t\tTemperature"
<< "\tHistogram" << endl;
int year = 2004;
float min_temp =
*std::min_element(v.begin(),v.end());
for (int i = 0; i < 10; ++i)
{
int stars = ((int) (v[i] -
min_temp)) + 1;
cout << year << "\t\t"
<< v[i] << "\t\t";
year++;
for (int i = 0; i < stars;
++i)
{
cout <<
"*" ;
}
cout << endl;
}
return 0;
}
Sample output:
Hello, I've tried the problem and I'm not geeting anywhere, please provide c++ code, and output....