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
Sloan [31]
3 years ago
5

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.
Note that if no characters from str2 appear in str1, the pointer will point to the NUL character at the end of str1.
Computers and Technology
1 answer:
Radda [10]3 years ago
7 0

Answer:

See explaination

Explanation:

#include<iostream>

using namespace std;

const char* firstOfAny(const char *str1,const char *str2){

const char *p=str1;

while((*p)!='\0'){

const char *q=str2;

while((*q)!='\0'){

if((*p)==(*q)){return p;}

q++;

}

p++;

}

return p;

}

int main(){

cout<<firstOfAny("ZZZZuker","aeiou");

cout<<endl;

cout<<firstOfAny("ZZZzyx","aeiou");

return 0;

}

You might be interested in
What type of data causes concern for institutions or business when collected, stored, and not secured properly
expeople1 [14]

Answer:

personal identeifying information

Explanation:

hope this is right and it helped

4 0
2 years ago
Which of the following should NOT be done to keep people from slipping on floors? A) Have the proper absorbents in an easy-to-fi
RoseWind [281]

The following options helps keep people from slipping on floors

A) Have the proper absorbents in an easy-to-find place to quickly put on spills : So that accidental little spills can be cleaned right away.

C) Wear slip-resistant footwear : It is a precautionary step to follow, no matter where we go.

D) Mark a slippery area with an easy-to-use tent sign that says " Caution, Slippery floor" : This allows people to be aware of the wet area and cross it cautiously.

Leaving oil and fluids to air dry thoroughly, takes a long time and there are chances that people step over it and slip.

So, the answer is

(B) Anytime oil or fluids are spilled on the floor, leave them to thoroughly air dry.

8 0
4 years ago
Read 2 more answers
It is important to give the health and safety experience to new or inexperienced workers, including those that have been away fr
Phoenix [80]

Answer:

a. training

Explanation:

"Training" is crucial when it comes to new workers or workers who are coming back after a long vacation or whatever reason. The risk of injuries and making mistakes is high for new workers because they are still adjusting to the company's processes. This is similar to a baby who's learning to walk. The baby makes several slips before mastering the skill. For a worker who has been away from the workforce, training should also be given because that worker needs to freshen up his skills and relearn what he needs to grasp before working.

This situation is especially true to <em>construction workers </em>who work under contractual projects. This means, they always have to be trained every time about their new jobsite before even working.

6 0
4 years ago
Gabe just won the lottery after ten years of consistently buying a ticket every Friday. Based on his initial reaction of feeling
ludmilkaskok [199]
The answer is D. cortisol level would most likely decrease.                                                                                                                                                                             

5 0
4 years ago
Read 2 more answers
If you could build your own personal computer, what components would you purchase? Put
lesya [120]

Always start with the choice of a CPU first because that would determine other components. For example, let's say I want want to use AMD Ryzen Threadripper 3990X as the CPU, all I need to do is to refer to its specification to know what other componets will be compatible.

With the specification, we can tell that this CPU is only compatible with DDR4 RAM (up to 4 slots) and PCIe 4.0 Graphic Card. So, I'd probably get 8 DDR4 RAM (any brand should be fine) and a RTX3080Ti GPU if there is no budget limit.

Next, since we have chosen the CPU, RAM and GPU, we can now choose a motherboard based on these choices. In other words, all we need to do is look for a motherboard that is compatible with our choice of CPU, GPU and RAM.

Then, I'll look for a cooler for the CPU because the stock cooler usually isn't good enough if I want to overclock the CPU.

Next, I would choose a power supply unit (PSU) that can provide enough power for the GPU that I have selected and compatible with the motherboard.

Next, I'd decide what data storage to use for this custom built pc. I highly recommend at least one PCIe 4. 0 SSD as a boot drive and one standard SATA Hard Disk to store all data. I'll also add in a SATA DVD drive. SATA connectivity is pretty standard for storage drives, so they should all be compatible.

Okay, let's breakdown the cost (without any peripherals such as keyboard, monitor, mouse, etc):

  • CPU AMD Ryzen™ Threadripper 3990X ($5546.20)
  • GPU Gigabyte AORUS MASTER GeForce RTX 3080 Ti ($3049.03)
  • Motherboard MSI Creator TRX40 ($1359.99)
  • Memory Corsair Dominator Platinum 128 GB (8 x 16 GB) DDR4-3200 CL16 Memory ($3998)
  • Storage Samsung 960 Pro 2TB ($1999.99)
  • Cooler NZXT Kraken X72 Liquid CPU Cooler ($479.90)
  • Case Phanteks Enthoo Elite ATX Full Tower ($915.98)
  • Power Supply Corsair AXi ($787.99)
  • Operating System Windows 10 Pro ($199.99)

The total cost would be around $18,283.50

How does it compare to a similar computer purchased? With these choices, there isn't any similar pre-built computer by other brands such as Dell or HP because this pc is VERY powerful and highly customizable. The key difference is probably the lack of after-sales customer service if you buy components separately from different stores.

3 0
3 years ago
Other questions:
  • The text discusses three approaches to combining overall cost leadership and differentiation competitive advantages. Which of th
    10·1 answer
  • Hugh is giving an informative speech about U.S. Senate election campaigns. Which thesis statement do you recommend he use?
    8·1 answer
  • Given the integer variables x, y, and z, write a fragment of code that assigns the smallest of x, y, and z to another integer va
    7·1 answer
  • Who was the inventor of the iPhone?
    13·2 answers
  • After an attacker has successfully gained remote access to a server with minimal privileges, which of the following is their nex
    15·1 answer
  • My PC won't output any data does anyone have any ideas​
    9·1 answer
  • Ben is writing a paper for his college history class, and he wants to include some information he found on a Web site. What are
    5·1 answer
  • What is the best way of transmitting data safely
    9·1 answer
  • _____is used to organize and modify the properties of the current selection.
    6·1 answer
  • Click the _______________________________ button in the css designer panel to create a new css files, or define an existing exte
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!