Given the IntNode class, define the FindMax() function to return the largest value in the list or -99 if the list is emp

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Given the IntNode class, define the FindMax() function to return the largest value in the list or -99 if the list is emp

Post by answerhappygod »

Given The Intnode Class Define The Findmax Function To Return The Largest Value In The List Or 99 If The List Is Emp 1
Given The Intnode Class Define The Findmax Function To Return The Largest Value In The List Or 99 If The List Is Emp 1 (37.06 KiB) Viewed 87 times
Given The Intnode Class Define The Findmax Function To Return The Largest Value In The List Or 99 If The List Is Emp 2
Given The Intnode Class Define The Findmax Function To Return The Largest Value In The List Or 99 If The List Is Emp 2 (40.51 KiB) Viewed 87 times
Given The Intnode Class Define The Findmax Function To Return The Largest Value In The List Or 99 If The List Is Emp 3
Given The Intnode Class Define The Findmax Function To Return The Largest Value In The List Or 99 If The List Is Emp 3 (36.88 KiB) Viewed 87 times
Given The Intnode Class Define The Findmax Function To Return The Largest Value In The List Or 99 If The List Is Emp 4
Given The Intnode Class Define The Findmax Function To Return The Largest Value In The List Or 99 If The List Is Emp 4 (35.69 KiB) Viewed 87 times
Given The Intnode Class Define The Findmax Function To Return The Largest Value In The List Or 99 If The List Is Emp 5
Given The Intnode Class Define The Findmax Function To Return The Largest Value In The List Or 99 If The List Is Emp 5 (45.47 KiB) Viewed 87 times
Given The Intnode Class Define The Findmax Function To Return The Largest Value In The List Or 99 If The List Is Emp 6
Given The Intnode Class Define The Findmax Function To Return The Largest Value In The List Or 99 If The List Is Emp 6 (35.23 KiB) Viewed 87 times
Given The Intnode Class Define The Findmax Function To Return The Largest Value In The List Or 99 If The List Is Emp 7
Given The Intnode Class Define The Findmax Function To Return The Largest Value In The List Or 99 If The List Is Emp 7 (35.23 KiB) Viewed 87 times
Given The Intnode Class Define The Findmax Function To Return The Largest Value In The List Or 99 If The List Is Emp 8
Given The Intnode Class Define The Findmax Function To Return The Largest Value In The List Or 99 If The List Is Emp 8 (42.47 KiB) Viewed 87 times
Given the IntNode class, define the FindMax() function to return the largest value in the list or -99 if the list is empty. Assume all values in the list are non-negative. Ex If the list contains: head -> 14 -> 191 -> 186 -> 181 FindMax(headNode) returns 191. Ex: If the list contains: head -> FindMax(headNode) returns -99. LAB ACTIVITY 1 #include <iostream> 2 using namespace std; 3 4 class IntNode ( 5 public: 6 7 S 9 19.10.1: Programming Assignment #10 10 11 12 13 14 15 16 17 // Constructor IntNode(int dataInit); // Get node value Int GetNodeData(); // Get poteter to next node IntNode GetNext(); / Insert node after this node. Before: this next After: this node next main.cpp 0/10 Load default template.
ACTIVITY Programming Assignment #10 18 "/ 19 void InsertAfter(IntNode* newNode); 20 21 private: 22 23 IntNode* nextNodePtr; 24 ); 25 26 // Constructor 27 IntNode:: IntNode(int dataInit) (1 28 this->dataval datalnit; 29 nextNodePtr nullptr; 30) 31 int dataval; 32 // Get node value 33 int IntNode::GetNodeData() { 34 return this->dataval; Develop mode Submit mode main.cpp Enter program input (optional) If your code requires input values, provide them here. 0/10 Load default template Run your program as often as you'd like, before submitting for grading Below, type any needed input values in the first box, then click Run program and observe the program's output in the second box
36 37 // Get pointer to next node 38 IntNode IntNode::GetNext() { 39 return this->nextNodePtr; 40) 41 42 / Insert node after this node. Before: this next 43 44 After: this node -- next 45/ 46 void IntNode:: InsertAfter(IntNode* newNode) { 47 IntNode tempNext 48 this->nextNodePtr; this->nextNodePtr newlode; newNode->nextNodePtr tempNext; 49 50 ) 51 52 // Return Largest value in the List Develop mode Submit mode main.cpp Enter program input (optional) If your code requires input values, provide them here. Load default template Run your program as often as you'd like, before submitting for grading. Below, type any needed input values in the first box, then click Run program and observe the program's output in the second box.
50) 51 52 // Return Largest value in the List 53 int FindMax (IntNode* headNode) { 54 55 /* Type your code here. */ 56 57 } 58 59 int main() { 60 61 62 63 64 65 66 IntNode headNode new IntNode(-1): IntNode currNode; IntNode lastNode; int max; // Initiatze head node headNode; lastNode Develop mode Submit mode main.cpp Enter program input (optional) If your code requires input values, provide them here. Load default template. Run your program as often as you'd like, before submitting for grading. Below, type any needed input values in the first box, then click Run program and observe the program's output in the second box
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79) 80 // Initiatze head node lastNode headNode; // Add nodes to the List for (int i = 0; i < 20; ++i) { currNode new IntNode(1); lastNode->InsertAfter(currNode); lastNode currNode; } max FindMax (headNode); cout << "Max is << max; return 0; Develop mode Submit mode main.cpp Enter program input (optional) If your code requires input values, provide them here Load defaut template Run your program as often as you'd like, before submitting for grading Below, type any needed input values in the first box, then click Run program and observe the program's output in the second box
Given the IntNode class, define the FindMax() function to return the largest value in the list or -99 if the list is empty Assume all values in the list are non-negative. Ex: If the list contains: head -> 14 -> 191 -> 186 -> 181 FindMax(headNode) returns 191 Ex: If the list contains: head -> FindMax(headNode) returns -99. Try? LAB ACTIVITY 1 #include <iostream> 2 using namespace std; 3 4 class IntNode ( 5 public: 19.10.1: Programming Assignment #10 6 // Constructor 7 IntNode(int datalnit); 9 10 // Get node value Int GetNodeData: main.cpp 0/10 Load default template.
LAB ACTIVITY 19.10.1: Programming Assignment #10 46 void intNode::insertarter(intNode* newNode) { 47 IntNode* tempNext this->nextNodePtr; this->nextNodePtr newNode; 48 49 newNode->nextNodePtr templiext; 50 ) 51 52 // Return Largest value in the List 53 int FindMax (IntNode" headNode) { 54 55 /* Type your code here. / 56 57 } 58 59 int main() ( 68 61 62 63 IntNode headNode new IntNode(-1); IntNode* currNode; IntNode lastNode; int max; Develop mode Submit mode Enter program input (optional) main.cpp 0/10 Load default template. Run your program as often as you'd like, before submitting for grading Below, type any needed input values in the first box, then click Run program and observe the program's output in the second box
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply