Not under standing looping for arrays. Looping through all of grab some or search. Can someone explain the process? Thanks in advance. Sorry if duplicate. I looked around and couldnt find a solid explaination that I could understand.
#include <fstream>
#include <iostream>
#include <string>
#include <cstring>
using namespace std;
void allContacts(string names[], string phones[])
{
    cout << "Showing all contacts... Press Q to go back to main menu" << endl;
}
void addName(string names[], string phones[])
{
    bool keepGoing;
    string input;
    beginning:
    for (int i = 0; i < sizeof(names); i++)
    {
        cout << "Enter contact name: ";
        cin >> names[i];
        cout << "Enter contact number: ";
        cin >> phones[i];
        cout << "Do you have another contact to add? y or no" << endl;
        cin >> input;
        if(input == "y" || input == "Y")
        {
            goto beginning;
        }
        if(input == "n" || input == "N")
        {
            cout << "Contacts you have entered: " << endl;
            cout << names[i] << " : " << phones[i] << endl;
        }
    }
}
void searchName(string names[], string phones[])
{
    string name;
    cout << "Enter Name: ";
    cin >> name;
    cout << "Search for a name or Press Q to go back to main menu" << endl;
    for (int i = 0; i < sizeof(names); i++){
        if (name == names[i])
        {
            cout << counter << names[i] << " 's phone number is: " << phones[i] << endl;
        } else {
            cout << "No results found";
        }
    }
}
int main()
{
    string names[100];
    string phones[100];
    int choice;
    cout << "============================" << endl;
    cout << "=== Welcome to PhoneBook ===" << endl;
    cout << "============================" << endl;
    cout << "1- Add a New Contact" << endl;
    cout << "2- Search By Name" << endl;
    cout << "3- Display All" << endl;
    cout << "0- Exit" << endl;
    cout << "Select a number: " << endl;
    cin >> choice;
    switch(choice)
    {
    case 1:
        addName(names, phones);
        break;
    case 2:
        searchName(names, phones);
        break;
    case 3:
        allContacts(names, phones);
        break;
    case 0:
        cout << "Exiting PhoneBook...";
            break;
    }
}
 
    