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
GalinKa [24]
3 years ago
7

Write a code in C++ that can save 100 random numbers in an array that are between 500 and 1000. You have to find the average of

the 100 random numbers. To find the average of the numbers, you have to use a functions. You are not allowed to use return, cin or cout statements in the functions.
Hint : you have to use function call by reference.
Computers and Technology
1 answer:
Anni [7]3 years ago
3 0

Answer:

#include <iostream>

#include <random>

//here we are passing our array and a int by ref

//to our function called calculateAverage

//void is infront because we are not returning anything back

void calculateAverage(int (&ar)[100], int &average){

 int sum = 0;

 for(int i = 0;i < 100; i++){

   //adding sum

   sum += ar[i];

 }

 //std:: cout << "\naverage \t\t" << average;

//calculating average here

 average += sum/100;

}

int main() {

 int value = 0;

 int average = 0;//need this to calculate the average

 int ar[100];

 //assign random numbers from 500 to 1000

 //to our array thats called ar

 for(int i = 0; i < 100; i++){

   value = rand() % 500 + 500;

   ar[i] = value;

   

 }

 calculateAverage(ar,average);

 // std:: cout << "\naverage should be \t" << average;

 

}

Explanation:

not sure how else this would work without having to pass another variable into the function but I hope this helps!

I commented out the couts because you cant use them according to ur prof but I encourage you to cout to make sure it does indeed calculate the average!

You might be interested in
Match the following
kakasveta [241]

Answer:

Eraser tool -removes the unwanted part of the drawing.

Row -horizontal space running from left to right.

Text -Primary component of a multimedia.

Drawing Area -Working are of ms point program.

I hope this helps!! Correct me plz if I'm wrong. If I'm right, could you mark me as brainliest?

8 0
2 years ago
Write the name of the tab, the command group, and the icon that you need to use to justify
Dafna11 [192]

Answer:

Tab: Home Tab

Command Group: Paragraph

Icon: Justify Icon

<em>The icon has no name; rather it is represented by 4 horizontal lines that are aligned on both edges</em>

<em />

Explanation:

To answer this question, I'll make use of the following attachment

<em>Where</em>

<em>1- represents the home tab</em>

<em>2 - represents the paragraph</em>

<em>3 - represents the justify icon</em>

<em />

3 0
3 years ago
In a switch statement, if a break statement is missing, _______________. Select one: a. the default case is automatically execut
Aleks [24]

Answer:

c. execution falls through the next branch until a break statement is reached

Explanation:

In a switch statement, if break is missing, then program continues to the next cases until it finds a break statement.

Consider the following example!

Example:

#include <iostream>

using namespace std;

int main()

{

  int choice = 1;

  switch (choice)

  {

      case 1:

      printf("This is case 1, No break\n");

      case 2:

      printf("This is case 2, No break\n");

      case 3:

      printf("This is case 3, with break\n");

      break;

      default: printf("Error! wrong choice\n");

  }

  return 0;

}

Output:

This is case 1, No break

This is case 2, No break

This is case 3, with break

We have 3 cases here and case 1 and 2 don't have break statements, only case 3 has a break statement.

We called the case 1, then program continued to case 2,  and finally to case 3 where it finds the break statement and terminates.

Therefore, we conclude that in a switch statement, if a break statement is missing, then execution falls through the next branch until a break statement is found.

8 0
3 years ago
Explain any one method of creating a presentation.
Arisa [49]

Answer:

Step 1: Analyze your audience

The first step in preparing a presentation is to learn more about the audience to whom you'll be speaking. It's a good idea to obtain some information on the backgrounds, values, and interests of your audience so that you understand what the audience members might expect from your presentation.

Step 2: Select a topic

Next, if possible select a topic that is of interest to the audience and to you. It will be much easier to deliver a presentation that the audience finds relevant, and more enjoyable to research a topic that is of interest to you.

Step 3: Define the objective of the presentation

Once you have selected a topic, write the objective of the presentation in a single concise statement. The objective needs to specify exactly what you want your audience to learn from your presentation. Base the objective and the level of the content on the amount of time you have for the presentation and the background knowledge of the audience. Use this statement to help keep you focused as you research and develop the presentation.

Preparing the Content of Your Presentation

Step 4: Prepare the body of the presentation

After defining the objective of your presentation, determine how much information you can present in the amount of time allowed. Also, use your knowledge about the audience to prepare a presentation with the right level of detail. You don't want to plan a presentation that is too basic or too advanced.

The body of the presentation is where you present your ideas. To present your ideas convincingly, you will need to illustrate and support them. Strategies to help you do this include the following:

Present data and facts

Read quotes from experts

Relate personal experiences

Provide vivid descriptions

And remember, as you plan the body of your presentation it's important to provide variety. Listeners may quickly become bored by lots of facts or they may tire of hearing story after story.

Step 5: Prepare the introduction and conclusion

Once you've prepared the body of the presentation, decide how you will begin and end the talk. Make sure the introduction captures the attention of your audience and the conclusion summarizes and reiterates your important points. In other words, "Tell them what you're going to tell them. Tell them. Then, tell them what you told them."

During the opening of your presentation, it's important to attract the audience's attention and build their interest. If you don't, listeners will turn their attention elsewhere and you'll have a difficult time getting it back. Strategies that you can use include the following:

Make the introduction relevant to the listeners' goals, values, and needs

Ask questions to stimulate thinking

Share a personal experience

Begin with a joke or humorous story

Project a cartoon or colorful visual

Make a stimulating or inspirational statement

Give a unique demonstration

During the opening you want to clearly present your topic and the purpose of your presentation. Clearly articulating the topic and purpose will help the listeners focus on and easily follow your main ideas.

During the conclusion of your presentation, reinforce the main ideas you communicated. Remember that listeners won't remember your entire presentation, only the main ideas. By reinforcing and reviewing the main ideas, you help the audience remember them.

[top of page]

Practicing and Delivering

Step 6: Practice delivering the presentation

Most people spend hours preparing a presentation but very little time practicing it. When you practice your presentation, you can reduce the number of times you utter words and phrases like, "um," "well," and "you know." These habits can easily diminish a speaker's credibility. You can also fine-tune your content to be sure you make your most important points in the time alloted.

In addition to planning the content of your presentation, you need to give advanced thought to how you want to deliver it. Do you want to commit your presentation to memory, use cards to guide you, or read from a script? Or, you might want to use a combination of methods. To help you decide, read the advantages and disadvantages of the four delivery methods described below.

Speaking from Memory

A human brain.

4 0
3 years ago
An independent frame that holds a program, document, or folder contents in windows 7 is called a ____.
svetlana [45]
Window.

Have a wonderful day!~
7 0
3 years ago
Other questions:
  • You use worksheets to perform calculations. How do you perform these calculations?
    15·2 answers
  • You have installed a point-to-point connection using wireless bridges and Omni directional antennas between two buildings. The t
    9·1 answer
  • To change the size of a field or record by dragging its border a.resize b.magnify c.label d.enlarge
    11·2 answers
  • A _____ is a member function that is automatically called when a class object is created.
    13·1 answer
  • Which of the following is a list of input devices?
    11·1 answer
  • If your database is in archivelog mode, how can you force an archive?
    7·1 answer
  • Select the correct answer.
    5·2 answers
  • Write a function max_magnitude() with two integer input parameters that returns the largest magnitude value. Use the function in
    6·1 answer
  • A digital footprint is .
    7·1 answer
  • What technique is most commonly associated with the use of malicious flash drives by penetration testers
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!