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
1. Keisha is in her first semester of college and is taking 10 credit hours: ACA 122, CIS 110, PSY 150, and developmental math.
serious [3.7K]

The advice is that she should not give up and that she should relax, and think of the time she comprehend more and then start to read. Another is to hire a private tutor to help or put her through.

<h3>What does a private tutor do?</h3>

A private tutor is known to be a person who is a specialist that has been trained in helping students known more and take in the concepts and details of any given course work.

Therefore, The advice is that she should not give up and that she should relax, and think of the time she comprehend more and then start to read. Another is to hire a private tutor to help or put her through and she will pass her exams in flying colors.

Learn more about private tutor from

brainly.com/question/6950210

#SPJ1

7 0
1 year ago
One last question
BlackZzzverrR [31]

Answer:

I love Chipotle!

Explanation:

I don't know, maybe because the food there is really good.

8 0
3 years ago
Read 2 more answers
Create a program in c/c++ which accepts user input of a decimal number in the range of 1 -100. Each binary bit of this number wi
kirill115 [55]

Answer:

// here is code in C++.

#include <bits/stdc++.h>

using namespace std;

void switch_fun(int input)

{

//array to store binary of input number

   int bin[7];

   // convert the number into binary

   for(int i=0; input>0; i++)

       {

           bin[i]=input%2;

           input= input/2;

       }

   // print the switch number and their status

   cout<<"Switch number:\t 1\t 2\t 3\t 4\t 5\t 6\t 7 \n";

   cout<<"status:      ";

   for(int j=6;j>=0;j--)

   {

   // if bit is 1 print "ON" else print "OFF"

       if(bin[j]==1)

           cout<<"\t ON";

       else

           cout<<"\t OFF";

   }

}

int main()

{

   int n;

   cout<<"enter the number between 1-100 only:");

   // read a number in decimal

   cin>>n

   // validate the input

   while(n<1 ||n>100)

   {

     cout<<"wrong input!! Input must be in between 1-100:"<<endl;

     cout<<"enter the number again :";

     cin>>n;

   }

// call the function with input parameter

  switch_fun(n);

return 0;

}

Explanation:

Read a decimal number from user. If the number is not between 1 to 100 the it will again ask user to enter the number until the input is in between 1-100.Then it will call the fun() with parameter n. First it will convert the decimal to binary array of size 7.Then print the status of switch.If bit is 1 then print "ON" else it will print "OFF".

Output:

enter the number between 1-100 only:-5

wrong input!! Input must be in between 1-100:

enter the number again :125

wrong input!! Input must be in between 1-100:

enter the number again :45

Switch number:   1       2       3       4       5       6       7

Status:          OFF     ON      OFF     ON      ON      OFF     ON

8 0
3 years ago
If a company uses multimedia applications in addition to normal file and database sharing, which transmission is more efficient?
Sonbull [250]

The transmission that is more efficient is the full duplex transmission.

<h3>What is database?</h3>

A database simply means an organized collection of a structured information in a computer program.

In this case, when a company uses multimedia applications in addition to normal file and database sharing, the efficient transmission is the full duplex transmission.

Learn more about database on:

brainly.com/question/26096799

#SPJ12

3 0
2 years ago
WILL UPVOTE ALL plz
evablogger [386]
Ash is the answer. Hope this helps
4 0
3 years ago
Other questions:
  • When desktop publishing software can interact with another software program, the two are said to
    6·1 answer
  • A. True
    6·1 answer
  • An attribute whose value uniquely identifies an object is called a(n) _______.​
    15·1 answer
  • True or false?
    13·1 answer
  • A browser is used for creating Web pages. true or false?
    5·2 answers
  • True or false? The following deterministic finite-state automaton recognizes the set of all bit strings such that the first bit
    7·1 answer
  • Alice and Bob decide to communicate using NTRUEncrypt with parameters (N, p, q) = (7, 3, 29). Alice’s public key is h(x) = 3 + 1
    15·1 answer
  • Exercise#3: Write a program that performs the following: Declare a two arrays called arrayA and arrayB that holds integer and th
    14·2 answers
  • ARGENT !!20 POINTS <br> А ________ translates commands from a computer to draw lines on paper.
    10·2 answers
  • In this assignment you will be building an implementation of the hypothetical machine simulator like the one discussed in chapte
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!