1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Maru [420]
2 years ago
7

In C++ please (read the image below for instructions)

Computers and Technology
1 answer:
FromTheMoon [43]2 years ago
8 0

Using the knowledge in computational language in C code  it is possible to write a code that  print the month name along with their rainfall inches. Then we have to calculate the total rainfall.

<h3>Writting the code:</h3>

<em>#include <bits/stdc++.h></em>

<em>using </em><em>namespace </em><em>std;</em>

<em />

<em>// function to print the rainfall of each month</em>

<em>void rainfallStatistics(string month[], double rainfall[]){</em>

<em>    </em>

<em>    double sum = 0; // variable to store the total sum of rainfall</em>

<em>    string maxMonth = month[0]; // variable to return month with maximum rainfall</em>

<em>    double </em><em>maxRainfall </em><em>= INT_MIN; // variable to store the maximum rainfall</em>

<em>    </em>

<em>    // running the loop till the last month</em>

<em>    for(int i=0; i<12; i++){</em>

<em>        </em>

<em>        // printing the month and rainfall</em>

<em>        cout<< month[i] << "           " << fixed << setprecision(2) << rainfall[i] << " inches" << endl;</em>

<em>        </em>

<em>        // storing the sum</em>

<em>        sum = sum + rainfall[i];</em>

<em>        </em>

<em>        // checking the month with highest rainfall</em>

<em>        if(rainfall[i] > </em><em>maxRainfall</em><em>){</em>

<em>            </em>

<em>            maxRainfall = rainfall[i];</em>

<em>            maxMonth = month[i];</em>

<em>        }</em>

<em>    }</em>

<em>    </em>

<em>    // calculating the average of the rainfall</em>

<em>    double average = sum / double(12);</em>

<em>    </em>

<em>    cout << endl;</em>

<em>    cout << "Total for the year " << sum << " inches" << endl;</em>

<em>    cout << "Average rainfall per month " << average << " inches" << endl;</em>

<em>    cout << "Month with the greatest rainfall was " << maxMonth << " with rainfall of " << </em><em>maxRainfall </em><em><< " inches" << endl;</em>

<em>    </em>

<em>}</em>

<em>// driver program</em>

<em>int main()</em>

<em>{</em>

<em>    // array to store the nonth name</em>

<em>    string month[12] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};</em>

<em>    </em>

<em>    // array to store the rainfall</em>

<em>    double rainfall1[12] = { 4.50, 4.25, 3.26, 1.35, 0.80, 0.20, 0.10, 0.00, 0.40, 1.20, 2.96, 4.71 };</em>

<em>    double rainfall2[12] = { 3.50, 1.25, 7.26, 8.35, 2.80, 0.00, 1.10, 4.00, 9.40, 2.20, 3.96, 4.71 };</em>

<em>    </em>

<em>    cout << "Hayward Statistics" << endl;</em>

<em>    cout << endl;</em>

<em>    cout<< "Month" << "         " << "Rainfall" << endl;</em>

<em>    </em>

<em>    // calling the function for Hayward</em>

<em>    </em><em>rainfallStatistics</em><em>(month, rainfall1);</em>

<em>    cout << endl;</em>

<em>    cout << endl;</em>

<em>    </em>

<em>    cout << "Houston Statistics" << endl;</em>

<em>    cout << endl;</em>

<em>    cout<< "Month" << "         " << "Rainfall" << endl;</em>

<em>    </em>

<em>    // calling the function for Houston</em>

<em>    rainfallStatistics(month, rainfall2);</em>

<em>    </em>

<em>    return 0;</em>

<em>}</em>

See more about c code at brainly.com/question/19705654

#SPJ1

You might be interested in
What format can be applied to text in Excel?
vladimir2022 [97]

Answer:

You can apply accounting format,date,numbers, currency, percentage or even fraction

Explanation:

3 0
3 years ago
Identify one type of business or organization that you believe would have serious risks if they chose to use VLANs and/or VPNs.
german

Answer:

National security agency

Explanation:

A lot of the private VPNs are own by corporations outside the USA, a national security agency is constantly sending sensitive and priceless data over the internet, when you decide to use a VPN it is possible for the service provider to share the decrypted information with others, therefore, if the national security agency at issue decide to use the service of an unscrupulous VPN provider their sensitive information could end in the hands of a foreign government who is willing to pay a lot for the data.

Note: there could be a case in which the VPN service provider is not corrupted, but the government forces them to share the information through legal actions.

5 0
4 years ago
Diane changes the size of an image with the format picture pane and keeps the original ratio of height to width of the object. W
bixtya [17]

Answer:

it's d.  

Explanation: post protected

7 0
3 years ago
Explain the effects of disposing electronic equipments to the environment ​
Rina8888 [55]

Answer:

When electronics are improperly disposed and end up in landfills, toxic chemicals are released, impacting the earth's air, soil, water and ultimately, human health.

5 0
3 years ago
Which of the following does NOT describe a node?
erica [24]

Answer:

hi sis i love you

Explanation:

6 0
3 years ago
Read 2 more answers
Other questions:
  • Building relationships during your career exploration is called
    9·2 answers
  • Which protocol is the data transmission standard for the Internet, responsible for sending information from one computer to anot
    14·1 answer
  • I need help with this problem plsssssssssssssss
    6·1 answer
  • Betty removed a web page from her website. Some users were browsing on her website. One of them clicked on a particular link and
    15·1 answer
  • LEAF library in py can be expressed in what form?
    6·1 answer
  • Write regular expressions for the following languages:
    5·1 answer
  • Hi good morning how are you all
    12·2 answers
  • Converting denary no 41 to binar
    12·1 answer
  • The process of identifying and eliminating bugs in a software program is most generally called reproducing the problem. diagnosi
    6·1 answer
  • The (blank) option will help determine the overall look of her presentation.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!