Answer:
The program to this question can be given as:
Program:
#include <iostream> //header file.
using namespace std; //using namespace
int main() //main method
{
int areaCode,exchange,lastFour; //define variable.
areaCode=800; //assign value.
exchange=555; //assign value.
lastFour=1212; //assign value.
cout<<areaCode<<"-"<<exchange<<"-"<<lastFour; //print value.
cout<<endl; //change values of variable.
areaCode=212; //assign value
exchange=867; //assign value
lastFour=5309; //assign value
cout<<areaCode<<"-"<<exchange<<"-"<<lastFour; //print value.
return 0;
}
Output
800-555-1212
212-867-5309
Step-by-step explanation:
- In the above c++ program firstly we include the header file. Then we define the Main method in the main method we define three integer variable that is "areaCode, exchange, and lastFour" and assign a value that is "800, 555, and 1212".
- Then we print the values of the variable. To print values we use the hyphen "-" in the middle of the variables and print values.
- Now we assign a different value to this variable that is "212, 867 and 5309" and to print this variable value we use the hyphen in like above.