Write a program to:
Use pointers to access array members.
Write a program that reads the values for the width, length, and height of a rectangular box using three variables of double type in the function main(). Pass values of these variables to a function, which calculates the volume and surface area for six sides of the box. The volume and surface area of the box passed back from two other arguments of this function are printed out in the function main(). Check your program with the user input for the width, length, and height of 2, 3, 4 meters, respectively.
For each of the following, write a single statement that performs the indicated task. Assume that long integer variables value1 and value2 have been defined and that value1 has been initialized to 200000.
a) Define the variable lPtr to be a pointer to an object of type long.
b) Assign the address of variable value1 to pointer variable lPtr.
c) Print the value of the object pointed to by lPtr.
d) Assign the value of the object pointed to by lPtr to variable value2.
e) Print the value of value2.
f) Print the address of value1.
g) Print the address stored in lPtr. Is the value printed the same as the address of value1?
You’re tasked with pairing up people with each other but you need to figure out how well both of them work together. In order to find out how effective each pair is, you need to create a program that adds both of their values and returns their sum.
Write a program/method to swap two neighboring numbers in an array when the first index is given
The first three lines will contain message prompts to input the three decimal numbers.
The last line contains the result in two decimal places.
a. Partially True
b. Absolute True
c. Partially False
d. Obviously False
Choose the appropriate one from the options above.
1. bool arr[ ] ={false, ture, 0}; is a calid array declaration and initialization.
2. float arr[6] = {43, 23.23 ,423 ,123.43 ,876,23}; is a valid array declaration and initialization.
3. int arr[55] = {1, 2, 3, 4123.34, 123.43, 876, 23}; is a valid array declaration and initialization.
4. int arr[2] = {1, 2, 3, 4123.34, 123.43, 876, 23}; is a valid array declaration and initialization.
5. float arr[20] = {43, 23.23 ,423 ,123.43 ,876, 23}; is a valid array declaration and initialization.
6. bool truth_table[ ] ={true}; is a valid array declaration and initialization.
7. int arr[ ] = {1, 2, 3, 4123.34, 123.43, 876, 23}; is a valid array declaration and initialization.
8.what is the output if the user input are the numbers 12, 23, 34, 45, 56, 67, 78, 89, 90, 101?
Your task is to develop a circular linked-list based simulation of the Josephus problem. The
simulation will be text based. The user should be presented with a text-based menu asking him to
enter the total number of people (n), starting point (i), direction (clockwise/anti-clockwise) and
number to be skipped (k).
Let’s take an example.
• For n =15 (i.e. number of people is 15)
• k = 2 (i.e. every 2nd person is killed)
• starting point (i) = 1
• direction = clockwise
Initial scenario: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
After 1
st iteration: 1 3 5 7 9 11 13 15
After 2
nd iteration: 3 7 11 15
After 3rd iteration: 7 15
After 4th iteration: 15 (15 remains in the end). Program stops here.
SAMPLE RUN:
Class Participation
Quiz 1: 90
Quiz 2: 95
Quiz 3: 89
Quiz 4: 80
Average: 88.5
Lab. 1: 100
Lab. 2: 95
Lab. 3: 80
Lab 4: 70
Average: 86.25
Assignment 1: 100
Assignment 2: 80
Assignment 3: 89
Assignment 4: 75
Average: 86
Class Participation: 34.73
Prelim Exam: 95
%: 57.00
Prelim Grade: 91.73
Remarks: PASSED
Test that array with both selection sort and bubble sort.Compute the time taken for each algorithm to complete.Repeat step two and three for 1000, 10000, 100000, and 1000000 random numbers.Plot the results in a graph