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
Dmitry [639]
3 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]3 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
Based on the following quote from Leonardo Da Vinci, what would be his definition of a fine artist? “Principles for the Developm
zvonat [6]

Answer:

A fine artist is one who sees the things other don't see and make connections other don't make.

7 0
3 years ago
Read 2 more answers
Discuss how and why video game hardware affects game design and where you think the next generation of platforms will change tho
katovenus [111]
Ever since video games were first released, graphics have been a huge selling point for popular games. On today's market, most new AAA titles (games with the largest available budget) are focused on improving graphics over previous AAA titles. But improvements in graphics requires a more difficult calculation for the computer hardware. When working with high resolution textures, the hardware need to be able to load in assets faster than ever and since there are physical limitations to how fast these assets can be loaded by the hardware, game designers have to limit their assets size. Without limitations most hardware wouldn't be able to handle the ever growing size of assets. So a game designer is limited by the power of the current hardware when designing assets. However since improvements are made every year on hardware, improvements in graphics quality and the like can also be made but will be limited to the hardware limitations of the future hardware. On a side note, virtual reality graphics were hard to render at a decent resolution a couple of years ago due to hardware limitations. But with the improvement in hardware came also the improvements in resolution and responsiveness of the virtual reality experience. Another aspect of video hardware is also the graphics drivers, compatibility, game engine and much more, but these are the basics of why hardware affects game design.
6 0
3 years ago
PLEASE HELP BRAINLIEST TO CORRECT ANSWER!!!
dsp73

Answer:

Blank #1 Meetup

Blank#2 MySpace

Explanation:

Blank# 1 Explanation

Meetup is a platform that enables to to seek out (or create!) local meetups. You mark your preferences when you register to this site. Meetup will then inform you of local meet ups that may concern you. The meetups cover a wide range of topics varying from technical issues, professional discussion to hobbies  etc. If you do not find topic of your interest, you may set up one and Meetup can inform relevant people who have marked your topic as something that interests them. It's a perfect platform to locally gather people with same interests.

Blank #2 Explanation

MySpace is a platform for social networking. It is a social networking website which offers an engaging, user network of friends, blog, personal profiles, forums, communities, images, songs, and videos.It used to be one of the largest social networking site in the world where people communicate and interact informally.

6 0
4 years ago
What is data mining?1) A particular attribute of information 2) The common term for the representation of multidimensional infor
tiny-mole [99]

Answer:

option 4)

Explanation:

  • Data mining is characterized as a procedure used to extricate usable information from a bigger arrangement of any crude data. It suggests breaking down information designs in huge groups of data utilizing at least one programming.  
  • Data mining is utilized to find patterns and connections in the information so as to help settle on better business choices.  
  • Information or data mining can help spot deals patterns, create more astute advertising efforts, and precisely foresee client faithfulness.
3 0
3 years ago
3.4 code practice question 2 edhesive
Gelneren [198K]
???????????????????
7 0
3 years ago
Read 2 more answers
Other questions:
  • Write the definition of a function divide that takes four arguments and returns no value . The first two arguments are of type i
    8·1 answer
  • Write a loop statement to count and display the number of positive integers in the array. That is, your loop should display the
    14·1 answer
  • A signal has a spectrum from 0 to 145 Hz, as shown below. It is sampled at a rate of 295 Hz. Find the region of the baseband spe
    5·2 answers
  • How to get the home button on your screen?
    13·1 answer
  • Which of the following is not System Software?
    5·1 answer
  • 5. The operating system has two components
    12·2 answers
  • If you created a variable called name, what data type would that value be?
    15·2 answers
  • 1st person to answer gets brainliest for free after 5 mins I wont be handing out brainliest
    11·1 answer
  • Give one reason why more people prefer to settle in areas of flat land than on steep slopes​
    8·2 answers
  • Structured query language (sql) enables data analysts to _____ the information in a database.
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!