Create program definition with the templates and methods

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

Directions Points

The file must be called week3-4Prog.cpp

This program will store in miniVector v a list of 15 random integers from 0 to 99, then it will output the vector, sort the vector, then output it again sorted.

Program Definition

1. Create program definition with the following templates and methods:

// output miniVector v
template <typename T>
void writeMiniVector(const miniVector<T>& v);
// use insertion sort to place miniVector v in descending order
template <typename T>
void sortMiniVector(miniVector<T>& v);

Main Method

1. Declare: miniVector<int> v;

2. Declare: randomNumber rnd;

3. call v.push_back(rnd.random(100)); to push 15 entries from 0-99 onto the vector

4. call writeMiniVector to output vector

5. call sortMiniVector to sort the vector

6. call writeMiniVector to output the sorted vector.

After you output the sorted vector:
Include: system("PAUSE"); after your output to pause the screen.

writeMiniVector Method (const miniVector<T>& v)
1. Iterate through the vector v and output each element to the screen.

sortMiniVector Method (miniVector<T>& v)
1. Sort the elements of vector v.

2. Since it is passed-by-reference, no return is necessary.

Example output of your program

Original: 59 18 60 91 49 47 83 93 55 52 15 36 83 56 91

Sorted: 93 91 91 83 83 60 59 56 55 52 49 47 36 18 15

Attachment:- d_except.zip

Reference no: EM13936914

Questions Cloud

Investigate the improvements in the indian common flying : Q1. Investigate the improvements in the Indian common flying industry after the division was opened up for the private players. Assess IA's execution. Why do you think IA neglected to hold its piece of the pie against contenders such as Jet Airways?
Integration of the relevant marketing theory : Insightful and comprehensive identification and discussion of key scholarly literature concerning the specialist marketing topic. • Advanced understanding and integration of the relevant marketing theory.
How pcr can be used in the diagnosis of a genetic disease : Explain how information of the sequence of cloned genes can shed light on the function of their coding genes. Explain how PCR can be used in the diagnosis of a genetic disease.
What variance investigation decisions would be made : Using the ± 2σ rule, what variance investigation decisions would be made? Present SQC charts for round-trip fuel usage for each of the three 747s in October. What inferences can you draw from them?
Create program definition with the templates and methods : This program will store in miniVector v a list of 15 random integers from 0 to 99, then it will output the vector, sort the vector, then output it again sorted.
Objective and subjective comprehension play in under armour : What role does objective and subjective comprehension play in Under Armour's ability to market its products by sponsoring up-and-coming athletes?
Find the dna sequence for the open-reading frame : show the cDNA sequence and corresponding primer sequence for both the upstream and downstream primers. be very clear about any base changes in the primer that are needed to create the restriction site and or maintain the correct reading frame.
Customer service officer in the destiny energy call centre : The problem Write a program that would be used by a customer service officer (CSO) in the Destiny Energy call centre. When a customer calls they will must either provide an account number or a meter number. The CSO will enter this into a text fiel..
Financial statement : Prepare a financial statement for 2014 had

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Variables - features of good program design

Explain one reason why the variable name in question is acceptable but not recommended, and provide an alternative name that would both satisfy the compiler and be recommended according to variable naming conventions.

  Write the function - void shuffle

Write the function: void shuffle(int ar[], int size); This function "shuffles" the elements in the array pointed by 'ar' (and whose length is 'size').

  Compare the running time of two versions of the insertion

implement Uniform Random Number generator and Generate 1000 Random number between 0 an 10000. Try to use insertion sort to sort them. Compare the running time of two versions of the insertion sort.

  Optimization is to add a sorting algorithm

The second optimization is to add a sorting algorithm. Each time you add an item to the array (from disk or from keyboard), you call a function called SortMyArray(), which use the bubble sorting algorithm to sort the array in the ascending order, ..

  Terms of the difference

A typical password is about 8 characters long (and so can be stored in 8 bytes, or 64 bits). However, a typical key for encryption/decryption is much longer, and a key of 64 bits would not be considered secure. Explain this in terms of the differe..

  Explain strings are an important part of programming

Strings are an important part of programming. They are used to transfer all sorts of data between the user and program, as well as from program to program. Humans communicate with streams because they are flexible enough to encode words and vari..

  Calculates an employees wage for a week

Write a program that calculates an employee's wage for a week. An employee's wage is calculated as follows - if the number of hours is less than or equal to 40, then the total payment is hour rate

  Determine the size of the square

1. An open box is to be made from a square piece of cardboard whose sides are 17 in long, by cutting squares of equal sizes from the corners and bending up the sides. Determine the size of the square that is to be cut out so that the volume may be ma..

  Write a program that requires the number of bits

Write a program that requires the number of bits for the exponent and significant of a floating point representation, then requires two decimal real numbers and an operation, sum, subtraction or multiplication.

  Disadvantages of designing an abstract data type

What are the disadvantages of designing an abstract data type to be a pointer and explain the dangers of C's approach to encapsulation.

  Which is not a valid name for a method or function

Which is not a valid name for a method or function? Which of the following is a valid overloaded version of this method

  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.

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