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, 22.06.2019 22:30
Who needs to approve a change before it is initiated? (select two.) -change board -client or end user -ceo -personnel manager -project manager
Answers: 1
question
Computers and Technology, 23.06.2019 20:40
On nba 2k 19, every time i try to join a my park game, it leads ro a website telling my dad that he needs ps plus. i already have ps plus though. how do i fix this?
Answers: 2
question
Computers and Technology, 23.06.2019 22:20
If i uninstall nba 2k 19 from my ps4 will my career be gone forever?
Answers: 2
question
Computers and Technology, 24.06.2019 10:00
Which feature of a blog to restore and retrieve older post
Answers: 3
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
Mathematics, 14.12.2020 16:30
question
Mathematics, 14.12.2020 16:30
Questions on the website: 13722363