Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using C++ The main purpose of this lab is to create functions using call-by-value and call- by-reference parameters. Activity #1 The first activity will be

Using C++

The main purpose of this lab is to create functions using call-by-value and call- by-reference parameters.

Activity #1

The first activity will be to write a function that sort an array of numbers (passed as a parameter) in ascending order. The input and output for the program are as follows:

Input/Output:

Enter 5 integers: 1 23 4 54 3

The array of integers sorted in ascending order is: 1 3 4 23 54

Include a function swapper(int& a, int& b) that can be used in your sort function. Save the source code in a file named assignment1.cpp.

Activity #2

Once you have completed the first activity, you should modify the program created in Activity #1 to take randomly generated input instead of command-line input. Save the source code in a file named assignment2.cpp.

Use the time command to detect how long it takes to sort 1000 numbers and 10,000 numbers. Include the time result as a comment in your program

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Contemporary Issues In Database Design And Information Systems Development

Authors: Keng Siau

1st Edition

1599042894, 978-1599042893

More Books

Students also viewed these Databases questions

Question

Define independent variables.

Answered: 1 week ago