Access over 20 million homework & study documents

Complete a function that determines if a given number can be found in

Content type
User Generated
Rating
Showing Page:
1/2
Complete a function that determines if a given number can
be found in a given unsorted vector. Remember that
vectors can be treated just like arrays in terms of
subscripting. bool NumberFoundlnVector(const std::vector
& list, int value) {
Solution
#include <iostream>
#include <vector>
#include <algorithm>
int main(int argc, char* argv[])
{
std::vector<unsigned int> V(10);
for(unsigned int i = 0; i < 10; i++)
{
V[i] = 10*i;
std::cout << V[i] << \" \";
}
std::cout << std::endl;
std::vector<unsigned int>::iterator it = find(V.begin(),
V.end(), 70);
if(it == V.end())
{

Sign up to view the full document!

lock_open Sign Up
Showing Page:
2/2

Sign up to view the full document!

lock_open Sign Up
Unformatted Attachment Preview
Complete a function that determines if a given number can be found in a given unsorted vector. Remember that vectors can be treated just like arrays in terms of subscripting. bool NumberFoundlnVector(const std::vector & list, int value) { Solution #include #include #include int main(int argc, char* argv[]) { std::vector V(10); for(unsigned int i = 0; i < 10; i++) { V[i] = 10*i; std::cout ...
Purchase document to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Anonymous
This is great! Exactly what I wanted.

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4