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
This is going to get taken down but I dont care add me on discord cause ima bored<br> -Red-#9847
Alex777 [14]

Answer:

I WILL

Explanation:

6 0
2 years ago
QUESTION: Which is not an example of a video port or cable?
Vikki [24]

Answer:

Radio Corporation of America (RCA)

Explanation:

A corporation is not a video connector.

8 0
3 years ago
Will give brainliest!!!!!!!!
dolphi86 [110]

Answer:

d the overall strength of colours

Explanation:

7 0
3 years ago
Read 2 more answers
8.10 Code Practice Question 3
Alchen [17]

terms = ["Bandwidth", "Hierarchy", "IPv6", "Software", "Firewall", "Cybersecurity", "Lists", "Program", "Logic",

        "Reliability"]

def swap(arr, in1, in2):

   w = arr[in1]

   arr[in1] = arr[in2]

   arr[in2] = w

print(terms)

swap(terms, 5, 1)

swap(terms, 2, 4)

swap(terms, 3, 5)

swap(terms, 5, 6)

swap(terms, 6, 8)

swap(terms, 8, 9)

print(terms)

This is how I interpreted the question. If I need to make any changes, I'll do my best. Hope this helps though.

4 0
3 years ago
Petra notices that there are a number of issues with a new fiber optic connection whose status appears to be going up and down c
DanielleElmas [232]

Fiber Internet is the wired choice of our present times. It has replaced traditional copper-based facilities.

<h3></h3>

How fiber optics are connected?

  • Fiber to the curb (FTTC) means your fiber connection goes to the nearest pole or utility box—not an actual concrete curb. After that, coaxial cables will send signals from the “curb” to your home. This means your connection is made up of part fiber-optic cables, part copper wires.
  • Twisted pair cabling simply refers to a wiring whereby two conductors that are gotten from a single circuit will be twisted together so that their electromagnetic compatibility can be enhanced.
  • This type of network cable is commonly used to connect office computers to the local network and it is used for Ethernet networks. A circuit is formed from the pair of wires which can be used in the transmission of data.
  • Fiber optic internet is a data connection carried by a cable filled with thin glass or plastic fibers. Data travels through them as beams of light pulsed in a pattern. Fiber optic internet speeds are about 20 times faster than regular cable at 1 Gbps.

To learn more about fiber refer to:

brainly.com/question/21808066

#SPJ4

5 0
1 year ago
Other questions:
  • In report design view, you can use commands on the align button of the _____ tab.​
    11·1 answer
  • To paste text with the same formatting as the document in which it is entered, select _____ from the Paste menu. Keep Source For
    12·2 answers
  • .in the array based list implementation of the ADT what is the worst case time efficiency of the remove method?
    6·1 answer
  • Whats the answer to this question?
    7·1 answer
  • Which of the following does not use a Graphic User Interface?
    14·1 answer
  • In needs analysis: Group of answer choices the costs of different physical network design alternatives are assessed the rate of
    10·1 answer
  • Assume that you are asked to develop a C++ program that help an elementary school teacher to
    9·1 answer
  • A signal has a wavelength of 1 11m in air. How far can the front of the wave travel during 1000 periods?
    7·1 answer
  • What online resource would you use if you wanted to read a review about a new movie?
    8·1 answer
  • As part of their extensive kitchen remodel, the Lees told their electrical contractors that they would need plenty of outlets fo
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!