Computers and Technology

Write the function findFirst(). The function has two parameters: a const char * s1 pointing to the first character in a C-style string, and a const char * s2. Return a pointer to the first appearance of s2 appearing inside s1 and nullptr (0) if s2 does not appear inside s. Here is the supporting file and please keep in mind we are working with c++ pointers and C-style strings/**CS 150 C-StringsFollow the instructions on your handout to complete the requested function. You may not use ANY library functions or include any headers, except for for size_t.*/#include // size_t for sizes and indexes WRITE YOUR FUNCTION BELOW THIS LINE function goes in here WRITE YOUR FUNCTION ABOVE THIS LINE These are OK after the function#include #include using namespace std;void CHECK(const char*, const char *, const string&);void studentTests(){cout << "Student testing. Add code in this function." << endl;cout << "" << endl;CHECK("Aardvark", "dv", "dvark");CHECK("Aardvark", "k", "k");CHECK("Aardvark", "rdv", "rdvark");CHECK("Aardvark", "arki", "nullptr");cout << endl;cout << "--done--" << endl;}int main(){studentTests();}#include void CHECK(const char * s1, const char * s2, const string& expected){string msg = "findFirst(\"" + string(s1) + "\", \"" + string(s2) + "\")";char d1[1024], d2[1024];strcpy(d1, s1);strcpy(d2, s2);auto p = findFirst(d1, d2);string actual = (p ? string(p) : "nullptr");if (expected == actual)cout << " + " + msg + "->OK" << endl;elsecout << " X " + msg + " expected<\"" + expected + "\">, found <\"" + actual + "\">" << endl;}

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 22:30, raiapowell
I'll mark brainliest if answered right! with which feature or menu option of a word processing program can you make an image like this? you can get this image using the option of a word processing program.
Answers: 1
image
Computers and Technology, 23.06.2019 14:30, Vanesssajohn2962
Norder to receive financial aid at his vocational school, mario must fill out the fafsa. the fafsa is a form that must be completed to determine . in order to complete a fafsa, you must submit . the fafsa can students obtain
Answers: 2
image
Computers and Technology, 24.06.2019 03:30, laylay120
Other - a written response, no less than arial 12-point font, to the following: of the following, which would you consider is most important to customer service goals? choose one and explain why. (1) accuracy (2) punctuality and attendance (3) courtesy (4) productivity (5) organization
Answers: 1
image
Computers and Technology, 24.06.2019 15:00, mbede002
Who introduced the concept of combining artificial and natural light in the studio
Answers: 1
Do you know the correct answer?
Write the function findFirst(). The function has two parameters: a const char * s1 pointing to the f...

Questions in other subjects:

Konu
Biology, 10.03.2021 22:30
Konu
Mathematics, 10.03.2021 22:30
Konu
Arts, 10.03.2021 22:30