chmod: WARNING: can\'t access prog.cpp chmod: WARNING: can\'t access ans.cpp #in
ID: 3733040 • Letter: C
Question
chmod: WARNING: can't access prog.cpp
chmod: WARNING: can't access ans.cpp
#include <iostream>
using namespace std;
struct NODE {int val; NODE * next;};
void BUILDList(NODE * & Head, int A[], int Asize); // Build list with array values.
// --------------------------------------------------------------------
// To compile: g++ prog.cpp LISTpkg.o
// --------------------------------------------------------------------
int main()
{
int A[8] = {2, 8, 4, 9, 7, 2, 6, 2}; // DO NOT MOVE, MODIFY, DELETE.
//-| ******* DO NOT MOVE, MODIFY, DELETE .... starting here. *****
NODE * L1, * L2; // DO NOT MOVE, MODIFY, DELETE.
int numVals = 0; // DO NOT MOVE, MODIFY, DELETE.
cin >> numVals; // DO NOT MOVE, MODIFY, DELETE.
BUILDList(L1,A,numVals); // DO NOT MOVE, MODIFY, DELETE.
//-| ******* MAKE YOUR CHANGES BELOW ***********
//-|----------------------------------------------------------------------------
//-| Display the first element in linked list L1, or EMPTY when list is empty.
//-|----------------------------------------------------------------------------
cout << " END" << endl; return 0; // DO NOT MOVE, MODIFY or DELETE.
}//main
==============
==> (1) File 'prog.cpp' has been placed in the testing directory.
==> (2) Work in a different window, in the testing directory
==> (3) Edit, compile and test the code in file prog.cpp
Explanation / Answer
#include <iostream>
using namespace std;
struct NODE {int val; NODE * next;};
void BUILDList(NODE * & Head, int A[], int Asize); // Build list with array values.
// --------------------------------------------------------------------
// To compile: g++ prog.cpp LISTpkg.o
// --------------------------------------------------------------------
int main()
{
int A[8] = {2, 8, 4, 9, 7, 2, 6, 2}; // DO NOT MOVE, MODIFY, DELETE.
//-| ******* DO NOT MOVE, MODIFY, DELETE .... starting here. *****
NODE * L1, * L2; // DO NOT MOVE, MODIFY, DELETE.
int numVals = 0; // DO NOT MOVE, MODIFY, DELETE.
cin >> numVals; // DO NOT MOVE, MODIFY, DELETE.
BUILDList(L1,A,numVals); // DO NOT MOVE, MODIFY, DELETE.
//-| ******* MAKE YOUR CHANGES BELOW ***********
//-|----------------------------------------------------------------------------
//-| Display the first element in linked list L1, or EMPTY when list is empty.
//-|----------------------------------------------------------------------------
if(L1 != NULL) {
cout<<"FIRST: "<<L1->val<<endl;
}else{
cout<<"EMPTY"<<endl;
}
cout << " END" << endl; return 0; // DO NOT MOVE, MODIFY or DELETE.
}//main
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.