CPPForSchool.com: Array - Single Dimension Set 1 Assignment 6

6. P is one-dimensional array of integers. Write a C++ function to efficiently search for a data VAL from P. If VAL is present in the array then the function should return value 1 and 0 otherwise.

For this assignment, I was not able to decipher what VAL was supposed to represent.  Presumably, it stood for value, but I was not 100% sure so I went ahead and reviewed the sample code.  With that said, I coded this assignment using functions once again.  Also, using bool was quite interesting.  I was unaware of how flexible bool can be utilized.  I have learned a great deal with this assignment.  Nevertheless, below is my source code along with the sample code for comparison.











Comments

Popular posts from this blog

CPPForSchool.com: Variable, Operator & Expression Set 1: Assignment 9

CPPForSchool.com: Variable, Operator & Expression Set 1: Assignment 8