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
dexar [7]
3 years ago
9

A contact list is a place where you can store a specific contact with other associated information such as a phone number, email

address, birthday, etc. Write a program that first takes as input an integer N that represents the number of word pairs in the list to follow.Word pairs consist of a name and a phone number (both strings). That list is followed by a name, and your program should output the phone number associated with that name.
Computers and Technology
1 answer:
NikAS [45]3 years ago
8 0

Answer:

C++.

Explanation:

<em>Code snippet.</em>

#include <map>

#include <iterator>

cin<<N;

cout<<endl;

/////////////////////////////////////////////////

map<string, string> contacts;

string name, number;

for (int i = 0; i < N; i++) {

   cin<<name;

   cin<<number;

   cout<<endl;

   contacts.insert(pair<string, string> (name, number));

}

/////////////////////////////////////////////////////////////////////

map<string, string>::iterator it = contacts.begin();

while (it != contacts.end())  {

   name= it->first;

   number = it->second;

   cout<<word<<" : "<< count<<endl;

   it++;

}

/////////////////////////////////////////////////////////////////////////////////////////////////////////

I have used a C++ data structure or collection called Maps for the solution to the question.

Maps is part of STL in C++. It stores key value pairs as an element. And is perfect for the task at hand.

You might be interested in
What are examples of people who own the copyrights of their property? Check all that apply.
jolli1 [7]
"Nevaeh thinks of a name for her new company", "Alexis thinks of an idea for a new product" and "Josiah writes a poem" are open to copyright because they can claim that their work is original and cannot be reproduced without their consent. 
3 0
3 years ago
Read 2 more answers
From the binary search algorithm, it follows that every iteration of the while loop cuts the size of the search list by half.
Colt1911 [192]

Answer:

True: In binary search algorithm, we follow the below steps sequentially:

Input: A sorted array  B[1,2,...n] of n items and one item x to be searched.

Output: The index of x in B if exists in B, 0 otherwise.

  1. low=1
  2. high=n
  3. while( low < high )
  4.  {      mid=low + (high-low)/2
  5.         if( B[mid]==x)
  6.          {
  7.             return(mid)  //returns mid as the index of x
  8.           }
  9.          else
  10.          {
  11.              if( B[mid] < x)      //takes only right half of the array
  12.               {
  13.                 low=mid+1
  14.               }
  15.              else               // takes only the left half of the array
  16.               {
  17.                high=mid-1
  18.               }
  19.           }
  20.  }
  21. return( 0 )

Explanation:

For each iteration the line number 11 or line number 15 will be executed.

Both lines, cut the array size to half of it and takes as the input for next iteration.

6 0
3 years ago
Which Traffic Source dimensions does Google Analytics automatically capture for each user who comes to your site?A. Source, Keyw
LenaWriter [7]

For each user who comes to your site the google analytics automatically capture the traffic source dimensions Source, Medium, Campaign name.

<u>Explanation:</u>

Source:

  • There cannot be any reference to a website without an origin source.
  • The source is basically the origin of your traffic such as a search engine (google) or a domain (ex: Twitter).

Medium:

  • Every referral to a website also has a medium along with the source.
  • examples are -:  unpaid search, "cost per click", referral, mail.

Campaign name:

  • The campaign Name is the name referring to the google ads campaign.
5 0
3 years ago
Express the following Boolean function using only the NOT and the AND operation
romanna [79]
Here, you go drawn , in paint. Please note that you can simplify further more the circuit by removing any two not following each other. 

3 0
3 years ago
Assume that source elements of length k are mapped in some uniform fashion into a target elements of length p. If each digit can
lukranit [14]

Answer And explanation

a)

r^k has 1/r^k probability guess the correct source

b)

Each element in r^p  is mapped by r^k / r^p . There are r^k^-^p  So there are  r^k^-^p -1 elements.

number of target elements = r^k^-^p

number of source elements = r^k^-^p -1

probability = r^k^-^p -1 /r^k

c) Probability of the correct target element

1/r^p

6 0
3 years ago
Other questions:
  • Why is it a mistake to put e-mail address of people who don't know each other in the "to:" field
    9·2 answers
  • Pseudocode is an improvement over the IPO chart because it lays out the a0 sequence of steps for a particular program.
    6·1 answer
  • What is the hexadecimal equivalent of the decimal number 256?
    11·1 answer
  • Make me die from laughter i will give brainlyest for the best joke
    11·1 answer
  • The information provided in text aids can help us to understand a text’s content before we even read it.
    8·1 answer
  • Derive an expression for the boolean function L(a,c) whose output is 1 when the light would be on. Note that two of the switches
    9·1 answer
  • The five types of personal computers are: desktops, laptops, tablets, smartphones, and
    9·1 answer
  • What will be the results from running the following code?
    12·1 answer
  • A common hardware component found in electronic devices including desktop computers, laptops, tablets and smartphones. The amoun
    5·1 answer
  • What’s the name of the technology that lets ryzen™ 5 series cpus access the entire gddr memory of radeon™ rx gpus?.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!