1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Vladimir [108]
3 years ago
10

Write the following function without using the C++ string class or any functions in the standard library, including strlen(). Yo

u may use pointers, pointer arithmetic or array notation.Write the function firstOfAny().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 any character inside str2.Return a pointer to the first character in str1 where this occurs.
Computers and Technology
1 answer:
mixer [17]3 years ago
5 0

Answer:

The function in C++ is as follows

int chkInd(string str1, string str2){    

int lenstr1=0;

while(str1[lenstr1] != '\0'){  lenstr1++;  }

int index = 0; int retIndex=0;

for(int i=lenstr1-1;i>=0; i--){

   while (str2[index] != '\0'){

       if (str1[i] == str2[index]){

           retIndex=1;

           break;         }

       else{   retIndex=0;      }

  index++;    }

  if (retIndex == 0){   return i;   }else{return -1;}}

}

Explanation:

This defines the function

int chkInd(string str1, string str2){    

First, the length of str1 is initialized to 0

int lenstr1=0;

The following loop then calculates the length of str1

while(str1[lenstr1] != '\0'){  lenstr1++;  }

This initializes the current index and the returned index to 0

int index = 0; int retIndex=0;

This iterates through str1

for(int i=lenstr1-1;i>=0; i--){

This loop is repeated while there are characters in str2

   while (str2[index] != '\0'){

If current element of str2 and str1 are the same

       if (str1[i] == str2[index]){

Set the returned index to 1

           retIndex=1;

Then exit the loop

           break;         }

If otherwise, set the returned index to 0

       else{   retIndex=0;      }

Increase index by 1

  index++;    }

This returns the calculated returned index; if no matching is found, it returns -1

  if (retIndex == 0){   return i;   }else{return -1;}}

}

You might be interested in
What EFC number will enable a student to receive the full amount of a Pell<br> Grant?
Eddi Din [679]

Answer:

I'm pretty sure to get the absolute maximum amount the EFC has to be 0 or really close to it. The EFC, or Expected Family Contribution, is mainly determined by your family's income. If your family has multiple students who will be enrolled in college, the number may be lower. It's not really about what number a student "should" have though, because the only way for you to lower it yourself is to lie, and you really don't want to do that-if you are found to have lied on your FAFSA there can be some serious legal consequences.

5 0
3 years ago
What is the service provided by a third party (such as an ISP) that enables you to connect another cloud directly to your Google
Olenka [21]

Answer:

A. Dedicated interconnect

Explanation:

With dedicated interconnect, there is a direct connection between your network and that of Google. It enables you to connect another cloud directly to your Google cloud resources to create hybrid cloud solutions. In other words, Dedicated Interconnect enables hybrid networking. Businesses can now extend their own private cloud into Google's cloud so they can switch control between the two with little latency. This gives them (businesses) control over the amount of data entering into the two clouds.

8 0
4 years ago
A hardware company is considering adopting customer relationship management solutions. What are the possible advantages the comp
irinina [24]

Answer:

Finding customers for your business is not easy. And once you find them, there comes another challenge – Establishing and maintaining strong relationships with them.

CRM software helps you centralize, optimize and streamline your communication. The better you know your customers, the stronger your relationships will be with them.

Here, we share 6 CRM benefits that focus on key customer relationship areas, allowing you to offer high-quality, consistent and timely interactions with your customers.

Explanation:

4 0
3 years ago
A listed electrical box for use in fire-resistive assemblies is being installed in a 2 hour rated wall. Assuming there are no ot
gtnhenbr [62]

Answer:

b. 1/8"

Explanation:

In This scenario this installation does not require any penetration protection as long as the space between the electrical box and the wall membrane does not exceed 1/8 of an inch. This is mainly a safety precaution to prevent accident's such as an electrical fire or electrocution as well as meeting the specs for the rest of the house to be built perfectly without modifications.

6 0
4 years ago
How many people employed in the United States work in a job related to digital media?
polet [3.4K]
I feel like more people are employed in the united states more than ever
5 0
3 years ago
Other questions:
  • One of the essential skills that software development engineers must have is the proficiency in at least one of the modern compu
    6·1 answer
  • When a structure satisfies all the properties of a relation except for the first item—in other words, some entries contain repea
    7·1 answer
  • Which one of the following is not the name of a 20th century school composition
    14·2 answers
  • _ is the use of a collection of computers, often owned by many people or different organizations, to work in a coordinated manne
    6·1 answer
  • :3 Brainlsit included! =) 33 points!
    10·1 answer
  • Give your own example of a nested conditional that can be modified to become a single conditional, and show the equivalent singl
    12·1 answer
  • What effect does social media have on teens?
    10·2 answers
  • Please help i will give brainiest. Plus 30 points
    9·1 answer
  • A relational database has been created to store data about subjects that students are studying. The following is a
    11·1 answer
  • What is memory address map​
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!