Write a second function called countelements

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

COMPUTER APPLICATIONS DIVISION

Assignment: C++ PROGRAMMING

STL Vector

For this assignment, you will be starting with an example program that demonstrates the use of a STL vector. In addition to this, you may need to look up how to generate random numbers.

Your end project will enter 100 random numbers (range 0-9) into the vector. Then, ask for a number to search for, and count how many there are in your group. When you complete the assignment, I want you to answer a couple questions about random numbers. Here are the details.

Start with the STL_Vector example. Use the rand function to generate random numbers between 0 and 9. If you need help generating random numbers see:

https://www.cplusplus.com/reference/cstdlib/rand/. Set up a for loop that puts 100 of these random number into a STL Vector. Change the printVector function in the example to print out all of the contents of your vector. Now you can see the contents of the vector which is the 100 random numbers you generated.

Write a second function called countElements. The definition will be:

int countElements( const std::vector<unsigned int>& MyVector, unsigned int SearchValue );

You will pass into countElements your vector (by reference), and the number you are looking for.

Your function will use a for loop with an iterator (like the one used in printVector) to compare each Vector element to the SearchValue. Count up the number of matches and return the total count.

You have an example executable program to mimic.

Questions to Answer in your ReadMe.txt file.

Are your numbers truly random? Run your program a number of times. Do you get the same numbers each time you run it? If not, can you make them random?

Put your findings in your ReadMe.txt file.

Reference no: EM131310293

Questions Cloud

Ummarize your course project and share any difficulties : Walmart is one of the largest companies in America; it has solidified its position as the biggest retailer in America and the world over with several branches all around the globe. Walmart prides itself in affordable products for everyday American..
How planning and operation flow differs for mto and mts firm : Discuss how the planning/coordination and operation flow differs for MTO and MTS firms.- Compare and contrast the role of planning/coordination and operations in improving firm competitiveness.
Principles in a business environment : You are to complete a minimum 500-word essay in which you describe resource pooling architecture and how you would apply these principles in a business environment.
Generate a second message that produces the same hash value : A network consists of n hosts. Assuming that cryptographic keys are distributed on a per-hostpair basis, compute how many different keys are required.
Write a second function called countelements : C0­227 C++ PROGRAMMING- Write a second function called countElements. The definition will be: int countElements( const std::vector & MyVector, unsigned int SearchValue );
Discuss the driver and role of the inventory deployment : Discuss why it is important to coordinate the arrival of procurement shipments with the dispatching of customer shipments.
Write a program that creates three identical arrays : Write program that create three identical array, list1, list2, and list3 of 5000 elements. Write a function, removeAt, that takes three parameters: an array of integers, the number of elements in the array, and an integer (say, index).
Role of crm system in enhancing the firms competitiveness : Discuss the rationale and risks associated with using a common forecast to drive the firms planning/coordination flow.
Principles in a business environment : You are to complete a minimum 500-word essay in which you describe resource pooling architecture and how you would apply these principles in a business environment.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

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