answer.
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
Dmitry [639]
2 years ago
10

c++ 2.30 LAB: Phone number breakdown Given a long long integer representing a 10-digit phone number, output the area code, prefi

x, and line number, separated by hyphens. Ex: If the input is: 8005551212 the output is: 800-555-1212 Hint: Use % to get the desired rightmost digits. Ex: The rightmost 2 digits of 572 is gotten by 572 % 100, which is 72. Hint: Use / to shift right by the desired amount. Ex: Shifting 572 right by 2 digits is done by 572 / 100, which yields 5. (Recall integer division discards the fraction). For simplicity, assume any part starts with a non-zero digit. So 999-011-9999 is not allowed. LAB
Computers and Technology
1 answer:
Nady [450]2 years ago
5 0

Answer:

#include <iostream>

using namespace std;

int main()

{

   //declare variable to store phone numbers,its area code, prefix and line number.

   long phone_number;

   int area_code, prefix,line_number;

   cout<<"Enter 10-digit phone number:"<<endl;

   //input 10-digit phone number

   cin>>phone_number;

   //logic to find area_code, prefix, and line_number.

   area_code = phone_number/10000000;

   prefix = (phone_number/10000)%1000;

   line_number = phone_number%10000;

   //output phone number in asked format.

   cout<<area_code<<"-"<<prefix<<"-"<<line_number<<endl;

   return 0;

}

Output:

Enter 10-digit phone number:

8005551212

800-555-1212

Explanation:

In the above program 10 digit phone number entered by user will be stored in the variable phone_number.

Then using this phone_number variable area_code, prefix, and line number are calculated using the following logic:

area_code = phone_number/10000000;

prefix = (phone_number/10000)%1000;

line_number = phone_number%10000;

Finally these area_code, prefix, and line_number are displayed with hyphen in between using cout statement.

You might be interested in
List any four routes of transmission of computer virus. <br>please give me answer​
JulijaS [17]

Opening attachments or links from unknown or spoofed emails. note: shown above are two examples of how viruses can often appear as legitimate messages, but are designed to trick the computer user. ...

Downloading software from malicious sites. ...

Online Ads. ...

Social media. ...

Unpatched software.

follow me

5 0
2 years ago
1. Consider a client and a server connected through one router. Assume the router can start transmitting an incoming packet afte
mezya [45]

Answer:

As the total bytes are L, when h bytes out of L are sent from client to router the router immediately send these h bytes forward to next router. Thus simultaneously another set of h bytes reaches the router and therefore many actions are being performed in a simultaneous way.  

Explanation:

For finding end to end delay, calculations are done and briefed.

All the paper work along with explanation is attached for better understanding.

5 0
2 years ago
Create a custom list using cells A2 A12.
Dafna1 [17]

Answer:

To create a list of the cells A2 to A12, convert the A2: A12 range to a table, then select the data validation tab, input list as the type and the name of the A2:A12 range table, and then click ok. This list can now be used as a validation list in another column or worksheet.

Explanation:

Microsoft Excel provides the power of tables and list for categorized data and data validation.

7 0
2 years ago
There are many different types of hardware devices, different manufacturers, and countless configuration possibilities. Explain
erik [133]

Because, they are all required to configure to it to be recognized by an operating system.

Explanation:

It is the Operating System Software that instructs the hardware and puts them together to work well. When the manufacturer does not configure the device to be recognized by an operating system, then it will not work with other components.

Example.

If an Apple machine's sound card is being put in an HP machine which uses Microsoft designed operating system, won't work due to the operating system that the sound card has been designed for.

6 0
2 years ago
A smart refrigerator can use _____ to detect when you are running low on milk, and then send a reminder to you on a wireless net
Brilliant_brown [7]

Answer:

IoTs

Explanation:

4 0
2 years ago
Other questions:
  • Ethan is a systems developer. He is working on a system where he will implement independent solutions for different processes. W
    14·1 answer
  • In what year were graphical user interfaces (GUIs) pioneered? 1969 1974 1991 2001
    12·2 answers
  • Which of the following best describes open-source web browsers?
    11·2 answers
  • Assignment 1 is to write a program that will write the lyrics to "X number of beers on the wall". Use only the main method. Prom
    11·1 answer
  • RADIAC instruments that operate on the ionization principle are broken down into three main categories based on what?
    15·1 answer
  • Jupiter Inc., a software firm, is starting to face competition from the new entrant in its market, Coral Inc. Jupiter wants to p
    12·1 answer
  • Assume that the population of Mexico is 128 million and that the population increases 1.01 percent annually. Assume that the pop
    7·1 answer
  • If productCost and productPrice are numeric variables, and productName is a string variable, which of the following statements a
    11·1 answer
  • Longer speeches should be separated into the paragraphs of:
    9·1 answer
  • What are ways to enter a formula in Excel? Check all that apply. Click on the Function Library group and select a function from
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!