Q:

Given the definitions of name and numbers on page 365, what does numbers.find(name) return

0

Given the definitions of name and numbers on page 365, what does numbers.find(name) return?

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

#include <string>
#include <iostream>

int main() {
  std::string numbers("0123456789"), name("r2d2");
  auto pos = numbers.find(name);  // std::string::npos
  if (pos != std::string::npos)
    std::cout << pos << std::endl;
  else
    std::cout << "npos" << std::endl;

  return 0;
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now