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
anastassius [24]
3 years ago
15

A personal phone directory contains room for first names and phone numbers for 30 people. Assign names and phone numbers for the

first 10 people. Prompt the user for a name, and if the name is found in the list, display the corresponding phone number. If the name is not found in the list, prompt the user for a phone number, and add the new name and phone number to the list. Continue to prompt the user for names until the user enters quit. After the arrays are full (containing 30 names), do not allow the user to add new entries. Use the following names and phone numbers: Name Phone # Gina (847) 341-0912 Marcia (847) 341-2392 Rita (847) 354-0654 Jennifer (414) 234-0912 Fred (414) 435-6567 Neil (608) 123-0904 Judy (608) 435-0434 Arlene (608) 123-0312 LaWanda (920) 787-9813 Deepak (930) 412-0991
Computers and Technology
1 answer:
Fynjy0 [20]3 years ago
4 0

Answer:

# include <iostream.h>

# include <stdio.h>

# include <string.h>

using namespace std;

class citizen

{      

    int i;

    public string name[30];

    public long int phonenumber[30];

    public void addindividual(string name1)

     {      

           If (i<=30)

            {     int flag=0;

                  for(int j=0; j<=i;j++)

                  {

                     if (strcmp(name[i], name1)

                      {

                          flag=1;

                      }

                     else

                     {  

                           flag=0;

                     }

                  }

                  If (flag)

                 {

                  if (i<30)

                  {

                  for(j=i+1;j<=30; j++)

                  {

                        cout<<"Enter the name:"; getchar(name[j]);

                        cout<<"Enter the phone number:"; cin>>phonenumber[j];

                         i++;

                   }

                  else  

                   {

                        cout<<"The person already exists";

                        exit();

                   }

              }

            else

             {

                 cout<<"array is full:";

                 exit();

             }

     }

}

Void main()

{

     string str;

    cout<<" Enter name:";

    getline(cin, str); ;

     citizen c1=new citizen();

     c1.addindividual(name1);

}

Explanation:

With a little more effort you can make the program allow the user to enter any number of details, but less than 30 overall. We have used here flag, and as a programmer we know why we use the Flag. It is used to check whether certain Boolean condition is fulfilled or not. Here, we are checking whether a given name is present in the array of names, and if it is not present, we add that to the list. And if the name is present, we print, it already exist.

You might be interested in
What is algorithm and how does it works​
andre [41]

Answer:

An algorithm, for the non-programmers among us, is a <u><em>set of instructions that take an input, A, and provide an output, B, that changes the data involved in some way</em>.</u> Algorithms have a wide variety of applications. In math, they can help calculate functions from points in a data set, among much more advanced things.

Explanation:

hope it helps

5 0
2 years ago
Read 2 more answers
A group of developers for a startup company store their source code and binary files on a shared open-source repository platform
Jet001 [13]

Answer: AWS CodeCommit

Explanation:

The AWS service that the developers can use to meet the requirements that are illustrated in the question is the AWS CodeCommit.

The AWS CodeCommit is refered to as a fully-managed source control service which can be used in the hosting of Git-based repositories which are secure.

AWS CodeCommit makes it easy for the collaboration on code for teams in a secure ecosystem. CodeCommit can securely store binaries, source code etc.

8 0
3 years ago
When the increment or decrement operator is placed before the operand (or to the operand's left), the operator is being used in
Salsk061 [2.6K]

When the increment or decrement operator is placed before the operand (or to the operand's left), the operator is being used in prefix mode. Postfix mode on the other hand is when the increment or decrement operator is placed after the operand (or to the oper and's right) .


8 0
3 years ago
How do I answer a question that was answered incorrectly on Brainly
Mashcka [7]

Answer:

Explanation:

Go and ask a teacher or search

6 0
3 years ago
Read 2 more answers
Most people entering the construction industry learn a specific craft through:
LuckyWell [14K]
Most people entering the construction industry learn a specific craft through: An apprenticeship program
7 0
3 years ago
Read 2 more answers
Other questions:
  • The _____ command icon looks like a small clipboard with a page attached.
    6·1 answer
  • The gaining of unauthorized access to data in a<br> system or computer:
    11·1 answer
  • Microprocessors can’t directly understand programming languages, so programs have to be converted into _____________ that corres
    15·1 answer
  • 20 points
    6·2 answers
  • The lines that connect the points of a polygon are called: (1 point)
    6·2 answers
  • A host is on the 192.168.146.0 network that has a subnet mask of 255.255.255.0. The binary value of the host portion is 11010101
    8·1 answer
  • ASAP BRAINLIEST!!!!!!
    5·2 answers
  • Answer This One Question Right For Brainliest
    10·1 answer
  • All Office programs have similar commands on the tab for changing the document view a. File b. View c. Locate d. display ​
    5·1 answer
  • Write a Java program that will be able to generate the sample table below.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!