Computers and Technology

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;
}

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 19:30, keke6361
When using a public computer or network, you should always
Answers: 2
image
Computers and Technology, 23.06.2019 03:50, nakeytrag
Iam a bacterium. i cause stomach cramps and diarrhea. i am caused by eating rotten foodssuch as chicken, fish, or eggs. sometimes turtles carry my bacteria. what am i?
Answers: 2
image
Computers and Technology, 23.06.2019 06:30, QueeeenUknown7437
How do you write an argumentative essay about the importance of free enterprise ?
Answers: 1
image
Computers and Technology, 23.06.2019 07:30, Morganwing1019
To check spelling errors in a document, the word application uses the to determine appropriate spelling. internet built-in dictionary user-defined words other text in the document
Answers: 2
Do you know the correct answer?
For this proficiency test you will write a program that works with an array of integers. The file su...

Questions in other subjects:

Konu
Mathematics, 20.10.2020 02:01