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
Lostsunrise [7]
3 years ago
11

Given a long integer representing a 10-digit phone number, output the area code, prefix, and line number using the format (800)

555-1212.
Computers and Technology
1 answer:
Alexxandr [17]3 years ago
8 0

Answer:

See explanation!

Explanation:

Here we have a program written in C++ language. Each // symbol is a relative comment explaining the reason for each command line (and is not included during the program execution).

<em>The Program: </em>

#include <iostream>

<em>//c++ build in library</em>

using namespace std;

<em>//main code body starts here</em>

int main()

{

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

  long pnumber;   <em>//declare long variable</em>

  int ac, prefix, lnumber;

 <em> //declare integer variables, where ac: Area Code and lnumber is the Line Number</em>

  cout<<"Enter a 10-digit Phone Number: "<<endl;

  <em>//cout command prints on screen the desired message</em>

  cin>>pnumber;

 <em> //cin command enables the user to interact with the programm and enter information manually</em>

 <em> //main body to obtain the desired output starts below</em>

<em>   //each 'division' is used to allocate the correct value at the correct </em>

<em>   //since prefix is used to get the desired output of ( )    -</em>

  ac = pnumber/10000000;

  prefix = (pnumber/10000)%1000;

  lnumber = pnumber%10000;

 <em> //main body ends here</em>

  cout<<"Based on your 10-digit number"<<endl;

  cout<<"below you have (AreaCode), Prefix, and - line number "<<endl;

  cout<<"("<<ac<<")"<<""<<prefix<<"-"<<lnumber<<endl;

 <em> //Prints on screen the desired output of the long 10 digit Number</em>

  return 0;<em> //ends program</em>

}

-------------------------------------------------------------------------------------------------------

<em>The Output Sample:</em>

Enter a 10-digit Phone Number:

8019004673

Based on your 10-digit number

below you have (Area Code), Prefix, and - line number

(801) 900-4673

<em>....Programm finished with exit code 0</em>

You might be interested in
One way bloggers decide how to present information is by understanding
PSYCHO15rus [73]

I would say strong use of multimedia.

4 0
3 years ago
Read 2 more answers
How can I make a video game?
Rainbow [258]
You first need to figure out what kind of game you would like to create. Find codes and certain websites that will help you set up and or make a game.
3 0
2 years ago
Read 2 more answers
Please help me I don’t know what I’m doing wrong.
Alinara [238K]

Answer:

Explanation:

I noticed the \n, \n will cause the new line break, delete it.

try code below:

<em>System.out.println(" " + " " + "NO PARKING");</em>

<em>System.out.println("2:00 - 6:00 a.m.");</em>

5 0
2 years ago
A blue line, called a ____ line, that appears when you are dragging a GUI object on a Windows Form object indicates that the obj
ser-zykov [4K]

Answer:

snap

Explanation:

The line which appears when we are dragging an object of GUI on a object of  windows Form indicates that the object that is being dragged is aligned horizontally with the object which is connected by the blue line is called a snap line.

Hence we conclude that the answer to this question is snap line.

3 0
3 years ago
To edit the text in a SmartArt graphic, what must be done first?
chubhunter [2.5K]
You have to go to where you first began the SmartArt then click on it to correct it. Or just double tap it and it should let you
3 0
3 years ago
Other questions:
  • When inside a closed work environment, its okay to openly talk with co-workers about PII
    6·1 answer
  • To add color to the entire background of a page, users will select the ___ feature?
    14·1 answer
  • Knowing what you know about today’s video games, imagine what it would look like if you had to create a modern-day version of Sp
    6·1 answer
  • Next, Kim decides to include a diagram of a frog’s life cycle in her presentation. She wants to use an image that is part of a p
    15·2 answers
  • What are potential problems with using nanorobots ?
    14·1 answer
  • Positive use of the technology before the pandemic.
    8·1 answer
  • What is a key differentiator of Conversational Artificial Intelligence (AI)
    11·1 answer
  • Four examples of computer virus​
    10·1 answer
  • What is one way a pivottable could combine the following data?
    8·1 answer
  • The condition known as __________ occurs when you try to store an integer that is bigger than the maximum allowed by the number
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!