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]
1 year ago
7

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

Computers and Technology
1 answer:
FromTheMoon [43]1 year 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
How does Technology impact any profession or occupation?
Brrunno [24]

Technology can create or dimish occupations.

Technology can also make the job easier

8 0
3 years ago
A mutation is _____.
Kipish [7]

Answer:

I am explain you in image

8 0
3 years ago
How many conditions are needed in a while loop that should run until a user guesses the correct number or until they have made f
Sonja [21]
<h2>[] Hello! []</h2>

Answer:

2

Explanation:

MS Coding 1 A ED

---------------------------------------------------------------------------------------

  • I hope this helped
  • Brainilest appreciated!
7 0
3 years ago
What is one outcome of an integration point?
mylen [45]

Answer:

What is one outcome of an integration point? It provides information to a system builder to potentially pivot the course of action. It bring several Kanban processes to conclusion. It supports SAFe budgeting milestones.

5 0
3 years ago
In which job role would a course in 3D modeling help with professional career prospects?please help
lana66690 [7]
Arcitechture, video game design, etc.
6 0
3 years ago
Read 2 more answers
Other questions:
  • Gloria needs to show in spreadsheet form the number of students in her class who speak different languages. Which type of graph
    7·1 answer
  • Describe how to manage the workspace by putting each feature under the action it helps carry out
    8·1 answer
  • When choosing a new computer to buy, you need to be aware of what operating _____ a0 it uses.
    6·1 answer
  • You could be electrocuted if you try to use water to put out a
    14·2 answers
  • You can upgrade a cpu by adding registers and cache memory to it. <br> a. True <br> b. False
    7·1 answer
  • What makes iron man different from other superheroes ? why is iron man the best superhero ??
    5·2 answers
  • A single-user/single-tasking operating system allows only one user to perform one task at a time. A real-time operating system g
    13·1 answer
  • Java !!!
    10·1 answer
  • Select the examples that best demonstrate likely tasks for Revenue and Taxation workers. Check all that apply. Brenda works for
    11·2 answers
  • In addition to being fun, another reason that people have been creating games ever since they settled into communities is:
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!