subject

For this proficiency test you will write a program that works with an array of integers. The file supplied. o contains binary code that can build, and display an array. For this test, you will need to write the following functions in array. cpp, add function prototypes for them to array. h and invoke the functions in main. cpp. - int sumOfArray(int list[], int size) Compute and return the sum of integers in list. - int remove(int list[], int
-void insert(node *& head, int position, int newInt)
insert newInt in a new node at index "position" where index starts with 0. In other words, the head node is position 0, head->next is position 1, etc. If the parameter position is less than or equal to zero, then place the new node at position 0. If position is greater than or equal to the length of the list, then place the new node at the end of the list. Notice that the head parameter is a reference to a pointer. So anything you do to head in insert() will modify the head pointer in main.
The code files will compile and run without modification, so you can see what build and display will do without adding any code. This may help you get started.
The function build() will create a linear linked list that is from 10 to 20 nodes in length.

The files are below.

//list. cpp
#include "list. h"
//put the implementation of your assigned functions here
β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”
//list. h
#ifndef LIST_H
#define LIST_H
#include
#include
#include
struct node
{
int data;
node * next;
};
/* These functions are already written and can be called to test out your code */
void build(node * & head); //supplied. The resulting list will have from 10 to 20 nodes.
void display(node * head); //supplied
void destroy(node * &head); //supplied
/* YOUR TURN! */
//Write your function prototype here:
#endif
β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”
//main. cpp
#include "list. h"
using namespace std;
int main()
{
node * head = NULL;
build(head); // build() and display() are provided by supplied. o.
display(head); // Don't try to write the function definitions for them.
//PLEASE PUT YOUR CODE HERE to call the functions assigned.
display(head);
destroy(head); // destroy() is also provided by supplied. o.
return 0;
}

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 06:00
Which statement is true of web-based social media? a.they allow consumers to interact with and update content. b.they cannot be updated easily, as compared to print media. c.they are expensive to produce and maintain, as compared to print and television. d.they can exist independent of the internet.
Answers: 1
question
Computers and Technology, 23.06.2019 18:00
Which is a possible benefit of having a good credit history? having a checking account low interest rate on a car loan high interest rate on a credit card offer bankruptcy
Answers: 1
question
Computers and Technology, 23.06.2019 18:30
Where can page numbers appear? check all that apply. in the header inside tables in the footer at the bottom of columns at the top of columns
Answers: 1
question
Computers and Technology, 23.06.2019 22:20
Read β€œsuburban homes construction project” at the end of chapters 8 and 9 (in the textbook) and then develop a wbs (work breakdown structure) in microsoft excel or in microsoft word (using tables)
Answers: 1
You know the right answer?
For this proficiency test you will write a program that works with an array of integers. The file su...
Questions
question
Physics, 14.09.2019 08:10
Questions on the website: 13722360