For who answers please use functions and only stick to array
For who answers, please use functions and only stick to arrays, for loops, while loops, if/ else if statements, reference variables, etc.. We haven\'t gone too deep into C++. I\'ve been working on this program for the past few days, but I just don\'t understand what to do.
Using functional decomposition, design and write a C++ program that inputs a series of hourly temperatures from a file, and you will create your own input data file with necessary data for your test cases. That is, your data file should have the at least values shown on the first column below. Also include invalid values. You will output a bar chart (using stars) of the temperatures for the day. The temperature should be printed to the left of the corresponding bar, and there should be a heading that gives the scale of the chart. The range of temperatures should be from –30 to 120. Because it is hard to display 150 characters on the screen, you should have each star represent a range of 3 degrees. That way, the bars will be at most 50 characters wide. Here is a partial example, showing the heading, the output for a negative temperature, and the output for various positive temperatures. Note how the temperatures are rounded to the appropriate of stars.
Use meaningful variable names, proper indentation, and appropriate comments. Thoroughly test the program using your own data sets.
If your input file has the following data:
 -20
 -50
 0
 1
 2
 3
 4
 5
 240
 10
 20
 30
 It should produce output shown below, and note that invalid values (not in the range specified) are just ignored.
Here is sample output, both written to the screen and to an ouput file, based in the values in the input file specified above.
Note that the values on the left hand side are the values read from the file.
In addition, note that 0 and 1 have no star while 2, 3 and 4 all have one star while 5 have 2 stars. It is not shown in the output but 6 and 7 should also have 2 stars.
Solution
#include <iomainip>
 #include <iostream>
 #include <string>
using namespace std;
const string stars = \"*\";
 const string line = \"|\";
int main()
 {
    float temperature;
    string fileName;
    float negative;
    float positive;
   
    cout<< \"Enter file name: \";
    getline(cin, fileName);
   
    if(!fileName)
    {
        cout<<\"Can not open the input file\";
        return 1;
    }
   
    if(temperature == positive)
    {
       temperature= 0;
       while(temperature <= 120)
       {
           count = 0;
           while(count <= temperature)
           {
               cout<<\'*\';
               cout++;
            }
            temperature++;
            cout<<endle;
        }
      
   
   
   
   


