Question
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 namedassignment2.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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started