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>