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]
4 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]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 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
Assume that name and age have been declared suitably for storing names (like "abdullah", "alexandra" and "zoe") and ages respect
schepotkina [342]

Answer:

Explanation:

It is assumed that name and age have been declared suitably for storing names and ages. so the following is the code to read in a name  and age and printout the message "the age of name is age. "

cin >> Name;

cin >> Age;

cout << "The age of " << Name << " is " << Age << ".";

7 0
3 years ago
Which area of the network would a college IT staff most likely have to redesign as a direct result of many students bringing the
zvonat [6]

Answer:

wireless LAN

Explanation:

An extranet is a network area where people or corporate partners external to the company access data. An intranet simply describes the network area that is normally accessed only by internal personnel. The wired LAN is affected by BYODs (bring your own devices) when the devices attach to the wired network. A college wireless LAN is most likely used by the tablet and smartphone. A wireless WAN would more likely be used by college students to access their cell provider network.

3 0
4 years ago
In what kind of attack can attackers make use of hundreds of thousands of computers under their control in an attack against a s
Allisa [31]

Answer:

distributed denial of service

Explanation:

5 0
3 years ago
Read 2 more answers
Two types of formulas in Excel, what are they? A. Complex and simple, B. General and currency, C. Logical and Boolean, D. Trig a
lyudmila [28]
A. Complex and simple
4 0
3 years ago
While cloud services are useful for small and midsize analytic applications, they are still limited in their ability to handle B
sp2606 [1]

Answer:

False

Explanation:

There are cloud applications which can effectively handle big data.

For example processing and handling big data technologies like Hadoop, Spark can be used on cloud.

Services like <em>Amazon Web Services</em> or <em>Google Cloud Services</em> allows users analyze big data with various tools.

5 0
3 years ago
Other questions:
  • A benefit of IPsec is __________.
    8·1 answer
  • Choose the word pair that would best complete this analogy <br> annihilation : obliteration
    7·1 answer
  • Using for loop . Input an integer and identify whether it's EVEN OR ODD ( without using modulo operator )
    9·1 answer
  • 12. Write C statement(s) that accomplish the following. a. Declare int variables x and y. Initialize x to 25 and y to 18. b. Dec
    12·1 answer
  • 1.6.M - Assignment: Understanding If Else Statements in Python
    7·1 answer
  • In this project you will demonstrate your knowledge of decision making blocks such as if statements. Objectives Building on ever
    11·1 answer
  • Which of these is a sign of healthy A)very high inflation B)A rise in consumers spending C)a shift supply of essential goods D)H
    7·2 answers
  • Can someone answer this for me will award brainliest lol
    11·2 answers
  • Which of the following correctly describes the reason for quality customer service?
    9·1 answer
  • Based on the strength of the magnetic fields they produce, arrange the solenoids from strongest to weakest
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!