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
erica [24]
3 years ago
5

Assign a pointer to any instance of searchChar in personName to searchResult.#include #include using namespace std;int main() {c

har personName[100];char searchChar;char* searchResult = nullptr;cin.getline(personName, 100);cin >> searchChar;/* Your solution goes here */if (searchResult != nullptr) {cout << "Character found." << endl;}else {cout << "Character not found." << endl;}return 0;}

Computers and Technology
1 answer:
Firlakuza [10]3 years ago
8 0

Answer:

Here it the solution statement:

searchResult = strchr(personName, searchChar);

This statement uses strchr function which is used to find the occurrence of a character (searchChar) in a string (personName). The result is assigned to searchResult.

Headerfile cstring is included in order to use this method.

Explanation:

Here is the complete program

#include<iostream> //to use input output functions

#include <cstring> //to use strchr function

using namespace std; //to access objects like cin cout

int main() { // start of main() function body

   char personName[100]; //char type array that holds person name

   char searchChar; //stores character to be searched in personName

   char* searchResult = nullptr; // pointer. This statement is same as searchResult  = NULL  

   cin.getline(personName, 100); //reads the input string i.e. person name

   cin >> searchChar;    // reads the value of searchChar which is the character to be searched in personNa,e

   /* Your solution goes here */

   searchResult = strchr(personName, searchChar); //find the first occurrence of a searchChar in personName

   if (searchResult != nullptr) //if searchResult is not equal to nullptr

   {cout << "Character found." << endl;} //displays character found

   else //if searchResult is equal to null

   {cout << "Character not found." << endl;} // displays Character not found

   return 0;}

For example the user enters the following string as personName

Albert Johnson

and user enters the searchChar as:

J

Then the strchr() searches the first occurrence of J in AlbertJohnson.

The above program gives the following output:

Character found.

You might be interested in
Two DHCP servers, Server1 and Server2, are running Windows Server 2016. As the administrator, you create a scope called Scope1.
kumpel [21]

Answer:

The answer is "Option a"

Explanation:

Split-scope is also an easy and simple approach to deliver DHCP consistency and workload management into your system. Server 2008 R2 provides a convenient divide-scope guide which removes several operational efforts but can only be to use if all databases run on R2, and wrong choices can be described as follows:

  • In option b, It uses the Ip address for multicast, that's why it is wrong.
  • In option c, It is wrong because it uses a windows interface, that works on policies.  
  • In option d, It is wrong because it is an administrative feature.

5 0
3 years ago
Order the following routine maintenance tasks from most to least important when securing a computer. a. Verify anti-malware sett
spin [16.1K]

Answer:

The following are the order of the routine maintenance tasks that is C, A, B, D

Explanation:

For securing the computer system the user has to follow some steps related to the routine maintenance tasks.

  • Firstly, the user has to validate the settings on the Windows Update.
  • Then, they have to validate the settings on the anti-malware software.
  • Then, the user has to validate the setting related to the file-sharing system.
  • Finally, they have to validate the frequent optimization of hard drives or hard disks.
7 0
3 years ago
Which of the following is the term for a device (usually external to a computer) that is plugged into a computer's communication
Serjik [45]

A device, usually external to a computer that is plugged into a computer's communication port or is connected wirelessly. Common peripherals are keyboards, mice, monitors, speakers, and printers

4 0
3 years ago
What defines "print media"? It is media that includes words and text rather than video, such as many blogs. It is media that is
uranmaximum [27]

Answer:

"It is media that is distributed in paper form, such as magazines and newspapers."

3 0
3 years ago
Who<br> invented the term “debugging”?
Black_prince [1.1K]

Grace Murray Hopper invented it

8 0
3 years ago
Read 2 more answers
Other questions:
  • Consider the following scenario: "You are an assistant to the accounting manager for a small company that sells sports equipment
    5·1 answer
  • The FTC found CardSystems Solutions and its predecessors __________ the FTC Act 15, U.S.
    12·1 answer
  • Desktop computer systems are less reliable than laptop computers. <br> a. True <br> b. False
    9·1 answer
  • Janet manages the security of the database servers at the mortgage company where she works. The servers are Windows Server 2016;
    15·1 answer
  • Suppose the length of each packet is L bits. Also, assume the path from a server to a client includes N links each of rate R (i.
    8·1 answer
  • What does it mean to clear a setting in a dialog box?
    14·1 answer
  • What would be the best thing you could do to prepare yourself to work for a company that has embraced globalization. A) learn ho
    12·2 answers
  • Write an algorithm to display your name 10 times​
    5·1 answer
  • Is a dot matrix printer an impact or non-impact printer
    12·2 answers
  • a) consider the binary number 11010010. what is the base-4 representation of (11010010)2? (there is a way to do this without con
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!