Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please Write the program in C++ language using simple terms that can be understo

ID: 3716983 • Letter: P

Question

Please Write the program in C++ language using simple terms that can be understood by beginners. Thank you!?

PLEASE DON'T GOOGLE IT !!

( IMPORTANT: Use a text file "contacts.txt" as an input to populate the string array )?

18. Phone Number List Write a program that has an array of at least 10 string objects that hold people's names and phone numbers. You may make up your own strings, or use the following: "Alejandra Cruz, 555-1223" "Joe Looney, 555-0097 "Geri Palmer, 555-8787 "Li Chen, 555-1212" Holly Gaddis, 555-8878" "Sam Wiggins, 555-0998 "Bob Kain, 555-8712" "Tim Haynes, 555-7676" "Warren Gaddis, 555-9037 Jean James, 555-4939 "Ron Palmer, 555-2783" Programming Challenges 611 The program should ask the user to enter a name or partial name to search for in the array. Any entries in the array that match the string entered should be displayed. For from the list: Geri Palmer, 555-8787 example, if the user enters "Palmer" the program should display the following names Ron Palmer, 555-2783

Explanation / Answer

#include<iostream>
#include<string>

using namespace std;

int main(){

   //string data[20];
   string name;

   string data[] = { "Alejandra Cruz, 555-1223",
            "Joe Looney, 555-0097",
            "Geri Palmer, 555-8787",
            "Li Chen, 555-1212",
            "Holly Gaddis, 555-8878",
            "Sam Wiggins, 555-0998",
            "Bob Kain, 555-7676",
            "Tim Hayens, 555-7676",
            "Warren Gaddis, 555-9037",
            "Jean James, 555-4939",
            "Ron Palmer, 555-2783"};

cout << "Enter a name/partial name:";
cin >> name;
int found1 = 0;
for (int i = 0; i<11; i++){
      size_t found = data[i].find(name);
      if (found != std::string::npos){
         found1 = 1;
         cout << data[i] << endl;
      }  
}
if (found1 == 0)
     cout << "Not found ";

    

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote