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
One of the biggest risks involved in using e-mail is
Maurinko [17]
The best answer to the question that is being presented above would be letter d. One of the biggest risks involved in using electronic mail or e-mail is the amount of junk mail you get from unsolicited, spamming, and phishing e-mail addresses.
8 0
3 years ago
Read 2 more answers
Write a loop that sets newScores to oldScores shifted once left, with element 0 copied to the end. Ex: If oldScores = {10, 20, 3
Anarel [89]

Answer:

The code to this question can be given as:

Code:

int lastVector = newScores.size() -1; //define variable lastVector that holds updated size of newScores.

newScores = oldScores; //holds value.

for (i = 0; i < SCORES_SIZE - 1; i++) //define loop.

{  

newScores.at(i) = newScores.at(i+1); //holds value in newScores.

}

newScores.at(lastVector) = oldScores.at(0); //moving first element in last.

Explanation:

  • In the given C++ program there are two vector array is defined that are "oldScores and newScores". The oldScores array holds elements that are "10, 20, 30, 40".
  • In the above code, we remove the array element at first position and add it to the last position. To this process, an integer variable "lastVector" is defined.  
  • This variable holds the size of the newScores variable and uses and assigns all vector array elements from oldScores to newScores. In the loop, we use the at function the removes element form first position and add in the last position.
  • Then we use another for loop for print newScores array elements.  
4 0
3 years ago
Professional networking is important for strengthening your professional development. Discuss how reading, writing, and speaking
Sergeeva-Olga [200]
Developing your reading skill helps you majorly, being able to read well is a skill not all have, and being able to read faster and better helps you'll need this sought after skill to be able to read the articles and present them to anyone you need to, as well and professionally as possible.

Developing your writing skills helps by, you'll be able to present your work and write better to really get your audience attention and make a point to them.

Developing your speaking skills helps for you to speak loudly and clearly. Doing this makes you seem confident and professional vital for business.
7 0
3 years ago
The portion of memory that is more or less permanent is called __________ memory.
lisabon 2012 [21]

The portion of memory that is more or less permanent is called <u>long term memory.</u>

<u></u>

<h3>What is Long-term memory?</h3>

Long-term memory guides to the memory process in the brain that takes knowledge from the short-term memory store and creates long-lasting memories. These recollections can be from an hour ago or several decades ago. Long-term memory can hold an unlimited amount of knowledge for an indefinite period of time.

<h3>What is long-term memory in psychology?</h3>

Long-term memory refers to unlimited storage information to be carried for long periods, even for life. There are two types of long-term memory: declarative or direct memory and non-declarative or implicit memory. Direct memory refers to information that can be consciously evoked.

To learn more about Long-term memory, refer

brainly.com/question/25040884

#SPJ4

6 0
1 year ago
Describe the function<br>ms word, Acess, Elexel, Power point<br>Publisher and Outlook​
marta [7]

Answer:

Write documents consisting mainly of text, Create databases, Create tables for organizing and calculating data, Create presentations to display in front of groups to display data and other info, Create advanced documents such as magazines, flyers, coupons, and other things, Organize your day and easily manage contacts and emails.

6 0
3 years ago
Other questions:
  • Styles are modified by using the Office clipboard in the Home tab. true or false
    5·2 answers
  • The syntax for multiplication function is ____________.
    8·1 answer
  • CNG and gasoline-powered vehicles use the same internal combustion engine, but different fuel types. A) True B) False
    8·2 answers
  • Which of these sites would need additional investigation to check for reliability?
    8·2 answers
  • Which hexadecimal-type address refers to a physical networking device such as a network interface card?
    10·1 answer
  • Which factor did not contribute to the increase of leisure travel in the early twentieth century in the United States?
    7·2 answers
  • Which of the following refers to a collection of colors, fonts, and effects that can be
    6·1 answer
  • A Cisco Catalyst switch has been added to support the use of multiple VLANs as part of an enterprise network. The network techni
    5·1 answer
  • You are developing a Windows forms application used by a government agency. You need to develop a distinct user interface elemen
    14·1 answer
  • In science class, Patricia is giving a presentation on the different types of flowers in her community. As part of her presentat
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!