Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hello can you help solve this problem? Thank you Practise Problem 1: Write a C+ program to reverse print an input list of numbers given

Hello can you help solve this problem?

image text in transcribed

Thank you

Practise Problem 1: Write a C+ program to reverse print an input list of numbers given by the user. Use pointer variables to store the data values used in the task. Your program should specifically do following tasks. First your program should ask the user for the number of values to given. Next, you should call a function to read the values from the user -the function should take only the number of values to be given as input parameter. The function should dynamically allocate memory for the list and should return pointer to the memory location storing the list as the return value You should call a function to reverse print the values stored in the list. The function should take the pointer to memory location of the list (and number of values in the list) and should SWAP the values in the original list. You should not use any temporary array for reversing the list. Instead call a swap function which takes two pointer arguments and swaps the values stored at memory locations referred by input pointers. The swap function can have a temporary variable Finally your program should make a call to print function taking the pointer to list, and the number of values as input parameters and should display the reversed list. . Practise Problem 2: Write a C++ program to print an input list of numbers given by the user in Sorted order. You should implement selection sort algorithm. Use pointer variables to store the data values used in the task. Your program should specifically do following tasks. .First your program should ask the user for the number of values to given. . Next, you should call a function to read the values from the user -the function should take only the number of values to be given as input parameter. The function should dynamically allocate memory for the list and should return pointer to the memory location storing the list as the return value . You should call a function to sort the values stored in the list in ascending order. The function should take the pointer to memory location of the list (and number of values in the list) and should SWAP the values in the original list. You should not use any temporary array for reversing the list. Instead call a swap function which takes two pointer arguments and swaps the values stored at memory locations referred by input pointers. The swap function can have a temporary variable Finally your program should make a call to print function taking the pointer to list, and the number of values as input parameters and should display the sorted list

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

Database Concepts International Edition

Authors: David M. Kroenke

6th Edition International Edition

0133098222, 978-0133098228

More Books

Students also viewed these Databases questions