subject

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;}

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 06:30
You have a small company and want to keep your costs low, but it is important your employees share data. which network would provide you with the most economical solution?
Answers: 1
question
Computers and Technology, 23.06.2019 09:30
Given a link with a maximum transmission rate of 32.8 mbps. only two computers, x and y, wish to transmit starting at time t = 0 seconds. computer x sends filex (4 mib) and computer y sends filey (244 kib), both starting at time t = 0. statistical multiplexing is used, with details as follows packet payload size = 1000 bytes packet header size = 24 bytes (overhead) ignore processing and queueing delays assume partial packets (packets consisting of less than 1000 bytes of data) are padded so that they are the same size as full packets. assume continuous alternating-packet transmission. computer x gets the transmission medium first. at what time (t = ? ) would filey finish transmitting? give answer in milliseconds, without units, and round to one decimal places (e.g. for an answer of 0.013777 seconds you would enter "13.8" without the quotes)
Answers: 3
question
Computers and Technology, 23.06.2019 11:20
Http is the protocol that governs communications between web servers and web clients (i.e. browsers). part of the protocol includes a status code returned by the server to tell the browser the status of its most recent page request. some of the codes and their meanings are listed below: 200, ok (fulfilled)403, forbidden404, not found500, server errorgiven an int variable status, write a switch statement that prints out the appropriate label from the above list based on status.
Answers: 2
question
Computers and Technology, 23.06.2019 14:00
Need ! will choose brainliest! discuss the role of abstraction in the history of computer software.
Answers: 1
You know the right answer?
Write the function findFirst(). The function has two parameters: a const char * s1 pointing to the f...
Questions
question
Mathematics, 27.02.2020 04:25
Questions on the website: 13722363