Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write the following function without using the C++ string class or any functions in the standard library, including strlen(). You may use pointers, pointer
Write the following function without using the C++ string class or any functions in the standard library, including strlen(). You may use pointers, pointer arithmetic or array notation. Write the function firstNot In (). The function has two parameters (str1, str2), both pointers to the first character in a C-style string. . You should be able to use literals for each argument. The function searches through str1, trying to find a match for the first character inside str1 that does NOT appear inside str2. Return the index of the first character in str1 that does not appear inside str2. Note that if all of the characters in strl appear in str2, then return the length of the C-String s1. (This will happen automatically if you write function correctly.) You can call the function like this: cout < < firstNotIn("eieioh", "aeiou"); // prints 5 (the index of h) cout < < firstNotIn("ZZZzyx", "aeiou"); // prints 0 (index of the first Z) In both of these cases, the function returns the index of the first character that is not in the set of vowels following it. Exam C++ Quick Reference Complete the following file: p1.cpp 1 #include // size_t for sizes and indexes 2 using namespace std; 3 ///////////////// WRITE YOUR FUNCTION BELOW THIS LINE 4 size_t firstNotIn(const char * s1, const char * s2) 5 { 6 7 8 9} 10 size_t result; // Add your code return result;
Step by Step Solution
★★★★★
3.53 Rating (156 Votes )
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started