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
n200080 [17]
4 years ago
12

Assign searchResult with a pointer to any instance of searchChar in personName.

Computers and Technology
1 answer:
Artyom0805 [142]4 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 personName  

  /* 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
1. Ce este o baza de date? (1p)
lesya [120]

Answer:

would you mind telling me what this says im still learning my spanish

Explanation:

6 0
3 years ago
Read 2 more answers
To a traditional computer, one means
blagie [28]

a.on , off

In most computer processors, electron movement is controlled by tiny switches that turn this flow of electricity on and off...zero represents off and one represents on

4 0
4 years ago
How do companies use web sites?
kramer

they us websites to look thing up that are need

hope this helps

5 0
4 years ago
...........is a systems development technique that tests system concepts and provides an opportunity to examine input, output, a
EleoNora [17]

Answer:Prototyping

Explanation:Prototyping is the software activity in which there is the production of the prototypes which has the incomplete form of application .It is used for the development of the real-world operating system and used in the field of the software development. It provides the benefit to the user by examining about the product's reliability , output, input etc .

3 0
3 years ago
What command limits structural changes, such as adding, deleting, or moving sheets, that can be made in a workbook?
Brilliant_brown [7]
The answer is Protect workbook
4 0
4 years ago
Other questions:
  • You are able to change the formatting of a table after it is inserted into a placeholder. True or false
    9·2 answers
  • Including quotes in your paper can bring additional meaning to the content True are false
    11·2 answers
  • This term describes two or more arrays that hold related data, and the related elements in each array are accessed with a common
    15·1 answer
  • Andrew is researching a new operating system for the computers at his workplace. His boss wants the computers to be able to conn
    10·1 answer
  • ____________ is a series of numbers that identifies a particular computer. They may or may not be a reliable way to link you to
    14·1 answer
  • A Linux-based OS is called a _____.
    9·1 answer
  • Images are available in many formats, such as tif, bmp, gif, jpeg, and ____.
    5·1 answer
  • Please help me!!!!!!!!
    5·2 answers
  • On the Audio Tools contextual tab, which tab will control how the audio file appears, if it appears, on the slide
    11·2 answers
  • Good morning beautiful people,
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!