Create an array function - generate random numbers

Assignment Help C/C++ Programming
Reference no: EM131267064

Objective

- The purpose of this program is to generate random numbers, report total number created, how many were 15, 16, or 17 and report this information to the user.

- You are required to use array, pointer and customised functions in this lab tutorial

Description of the Problem

Your program should contain the prototypes fillArray, count15s16sAnd17s, and writeResults functions. In your main function:

1. Create an array of 1000 integers in your main function.

2. The array is passed to a function named fillArray.
- The function asks the user for the seed value and calls srand().
- Next, it fills the array with random numbers that are within the range 10 to 50 inclusive-that is, the possible numbers are 10, 11, 12, ... 49, 50.
- Use modulus arithmetic and simple arithmetic to adjust each of your random numbers to be within the given range.

3. From main, call a function named count15s16sAnd17s.
- The function is passed your array of numbers.
- The function goes through your array and counts the total number of 15's, 16's, and 17's that are in your array.
- The function "returns" the total number of 15's, 16's and 17's.

4. Call a function named writeResults,
- The function is passed the three total values (count of 15's, 16's, and 17's).
- The function writes the three totals to the screen in a manner similar to what is shown below.

5. Do not have a "do another" loop. Your program will run this set of functions only once.

Sample Output

This program generated 1000 random numbers within the range 10 to 50.

The total number of 15's is 23.

The total number of 16's is 27.

The total number of 17's is 25.

Reference no: EM131267064

Questions Cloud

Market demand for monopolist product : Consider a monopolist described by the following equations: Market demand for monopolist's product: P = 100 - Q
Evaluate the role of an executive level bpm group : Evaluate the role of an Executive Level BPM Group. Who would be members of that group and how is this group responsible for reducing resistance to change
What could you do to prevent moral hazard after employees : Why would you worry about moral hazard after hiring new bartenders arid servers? What could you do to prevent moral hazard after hiring these employees?
Competitive industry with long-run economic costs : The treadmill market is a competitive industry with long-run economic costs. Provided the following information, what is the long-run equilibrium price in this industry?
Create an array function - generate random numbers : Generate random numbers, report total number created, how many were 15, 16, or 17 and report this information to the user.
What are the expected outcomes when using each kind : What are the differences in types of data / information among the three venues? What are the expected outcomes when using each kind? For example, does using available data enable one to determine cause and effect? Which venue utilizes narrative and..
Product in a competitive market : A firm is selling a product in a competitive market at a price of $50 per unit. Using the information below regarding cost, what are the firm's profits?
Explain channel leadership and partnering : Explain channel leadership, conflict, power, and partnering. Power, control, leadership, conflict, and partnering are the main social dimensions of marketing channel relationships.
Product in a competitive market : A firm is selling a product in a competitive market at a price of $50 per unit. Using the information below regarding cost, what are the firm's profits?

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Write a program to calculate the area of a circle

Write a program to calculate the area of a circle. The program should use two procedures. The first procedure will print out the program heading and ask the user to enter the radius. The second procedure should calculate the area. The area of the cir..

  Perform the five arithmetic operations

A program that declares and prompts the user to enter two integer and performs the five arithmetic operations

  Write program in c++ for cosx and sinx expansion

Write program in c++ for cosx and sinx expansion( for personal inputs are x,number of terms

  Multiply a set of complex numbers

Write a C program to multiply a set of complex numbers stored in an array (that has been dynamically allocated). Specifically, first prompt the user to enter how many complex numbers need to be multiplied, dynamically create an array to store the ..

  Program that can serve as a simple calculator

Write a program that can serve as a simple calculator. This calculator keeps track of a single number (of type double) that is called result and that starts out as 0.0. Each cycle allows the user to repeatedly add, subtract, multiply, or divide by..

  Program that will calculate the heat transfer of a substance

write a program that will calculate the heat transfer of a substance (water) given three different shapes. The user has to be able to input the type of shape, so that the computer can calculate area, and plug it back in to the equation for heat trans..

  Requirements of flyhigh airlines

The development team of SoftSols Inc. has revamped the software according to the requirements of FlyHigh Airlines and is in the process of testing the software. While testing the software, the team encounters the following issues:

  Write a program that finds the equivalent series

Write a program that finds the equivalent series and parallel resistance for a collection of resistor values. Your program should scan first the number of resistors and then the resistor values. Then compute the equivalent series resistance for all r..

  Implement the appropriate methods for big numbers

You must implement each big number as a List of single digits and you must also set up the template class List based on a linked list (use the sample codes). You will need to define and implement the appropriate methods for big numbers.

  Please low is studentgrade class problem

1.Please low is StudentGrade class problem, please modify it so that all methods are marked const that can be. Make sure you have a constructor that accepts all data values. Create a simple main function that declares a constStudentGrade object and d..

  Object-oriented programming with vcl form

I need someone to help in my project which is windows application program. It supposed to be in program Object-Oriented Programming in C++ with VCL form.

  Afunction that raises an integer to a positive integer

Write a function that raises an integer to a positive integer power. Call the function x_to_the_n, taking two integer arguments x and n.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd