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
kolbaska11 [484]
3 years ago
12

Write a program that has an array of at least 50 string objects that hold people’s names and phone numbers. The program then rea

ds lines of text from a file named phonebook into the array. The program should ask the user to enter a name or partial name to search for in the array. All entries in the array that match the string entered should be displayed-- thus there may be more than one entry displayed. The program prints the message "Enter a name or partial name to search for: " and then after the user enters some input and hits return, the program skips a line, and prints the heading: "Here are the results of the search:", followed by each matched string in the array on a line by itself. Input Validation: None
Computers and Technology
1 answer:
Readme [11.4K]3 years ago
8 0

Answer:

See explaination

Explanation:

#include <iostream>

#include <fstream>

#include <string>

using namespace std;

int main()

{

const int SIZE = 50;

string phoneDirectory[SIZE];

int size=0;

string name; //name to look for

ifstream inFile;

inFile.open("phonebook");

while (!inFile.fail()) {

getline(inFile,phoneDirectory[size]);

size++;

}

inFile.close();

// Get a name or partial name to search for.

cout << "Enter a name or partial name to search for: ";

getline(cin, name);

cout << "\nHere are the results of the search: " << endl;

int numberEntriesFound = 0;

for (int k = 0; k < size; k++)

{

if (phoneDirectory[k].find(name.data(), 0) < phoneDirectory[k].length())

{

numberEntriesFound ++;

cout << phoneDirectory[k] << endl;

}

}

if (numberEntriesFound == 0)

cout << "\nNo Entries were found for " << name;

return 0;

}

You might be interested in
Remember for a moment a recent trip you have made to the grocery store to pick up a few items. What pieces of data did the Point
Umnica [9.8K]

Answer:

Data: Data are raw facts and figures that are collected together for analysis. In other words, Simple no processing is data.

Information: Information is the facts provided about something. In simple terms, processed data is information.

Knowledge: Knowledge is the processed facts that are understand for a conclusion.

1. An item's UPC number - data

Explanation: An item number is data because simple no processing is required.

2. Change back to customer - information

Explanation: Data about a customer is information.

3. General changes to demand in different seasons - knowledge

Explanation: Requires data (time and quantity purchased) to be processed/aggregated into information. The information is understood to provide a pattern of demad changes due to seasons.

4. Cost each - data

Explanation: Cost each is data because simple no processing is required.

5. Quantity purchased - data

Explanation: Cost each is data because simple no processing is required.

6. Non-taxable total - information

Explanation: -- requires that data (prices, amounts and whether the item is taxable) to be processed (price * amount for items that are non-taxable).

7. Extended cost [quantity times cost each] - information

Explanation: Extended cost requires processing two pieces of data quantity and cost

8. Amount tendered - data

Explanation: Amount tendered is data because simple no processing is required.

9. Sales of an item for the last week - information

Explanation: Sales of an item for the last week requires aggregating sales for a specific time frame together

10. Upcoming holidays and customer's special needs - knowledge

Explanation: Upcoming holidays and customer's special needs requires holiday data (dates) to be combined with information gathered about customer to understand customer's special needs

11. How paid [cash, charge card, debit card] - data

Explanation: Cost each is data because simple no processing is required.

12. Shopper loyalty card number - data

Explanation: Cost each is data because simple no processing is required.

13. Taxable total - information

Explanation: Taxable total requires that data (prices, amounts and whether the item is taxable) to be processed (price * amount for items that are taxable).

Explanation:

6 0
3 years ago
Imagine that you are preparing a multimedia presentation. What are the four things you need to consider when getting started?
Marrrta [24]

Explanation:

Consider the Content

Create an Outline

Develop Your Presentation

PRACTICE!!

8 0
3 years ago
Read 2 more answers
Write code to complete print_factorial()'s recursive case. sample output if user_val is 5: 5! = 5 * 4 * 3 * 2 * 1 = 120
maxonik [38]
```
#!/usr/local/bin/python3


import sys

def print_factorial( user_val ):
    if( user_val < 1 ):
        return( 1 )
    else:
        return( print_factorial( user_val - 1 ) * user_val )


if( __name__ == "__main__" ):
    if( len( sys.argv ) == 2 ):
        print( print_factorial( int ( sys.argv[ 1 ] ) ) )
    else:
        sys.stderr.write( "usage: %s <integer>\n" % sys.argv[ 0 ] )

    exit( 0 )
```

5 0
3 years ago
Which component of service-oriented DSS can be defined as data that describes the meaning and structure of business data, as wel
Licemer1 [7]

Answer:

The correct answer to the following question will be Metadata Management.

Explanation:

The management of data about the other data is known as Metadata Management. When the data is generated, updated, deleted, created, metadata is generated.

Benefits of Metadata management:

  • To locate data for a person, the metadata management make it easier.
  • Project delivery become faster.
  • Maintain information of organization.

Hence, the Metadata Management will be the best suitable component which defined as the structure and meaning of business data.

4 0
3 years ago
What was the first Apple computer, and who was it designed by?
DerKrebs [107]

Answer: The first Apple Computer was Apple 1. The designer was Steve Wozniak.

Explanation: Steve Wozniak and Steve Jobs both created Apple 1. Mainly, Steve Wozniak designed it.

Hope this helps!

7 0
3 years ago
Read 2 more answers
Other questions:
  • Operating system software allows you to use your fingers, a mouse or other pointing device to select screen controls, such as bu
    5·2 answers
  • Write a program that asks the user to input four numbers (one at a time). After the four numbers have been supplied, it should t
    6·1 answer
  • What component of a computer system holds the operating system when the computer is not running
    6·2 answers
  • Write a method reverse( ) for OurLinkedList class. The method should return a new OurLinkedList object that is the reverse of th
    8·1 answer
  • Which key combination will allow users to move to the top of a document?
    15·1 answer
  • Assume that strikeCounter has already been declared to be a "pointer to int". Assume further that strikeCounter has been initial
    5·1 answer
  • A computer virus is a program that can copy itself and infect a computer without the permission of the owner. How do you think a
    9·1 answer
  • Write a program that repeatedly reads in integers until a negative integer is read. The program keeps track of the largest integ
    9·1 answer
  • Sorry, I cant tell you, you need to know
    5·2 answers
  • One word for The characters typed by a user using a<br> keyboard.
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!