Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

B (36%) - Short Questions Answer ALL questions in this section in the answer book provided. Each question carries 12 marks. Question B1 Write your

B (36\\%) - Short Questions Answer ALL questions in this section in the answer book provided. Each question carries 12 marks. Question B1 Write your code for the main() function to produce the required sample outputs. The program asks the user for an 8-digit phone number. If the entered number is not an 8-digit number, it prints an error message and asks the user to input again until it is correct. It then prints whether it is a "fixed-line" number (a number that starts with 3 or 5), a "mobile" number (a number that starts with 6 or 9), or an "invalid" number (other cases). \\#include using namespace std; int \\( \\operatorname{main}() \\) i int phone_num; cout \\( \\ll \\) "Enter 8-digit phone number: "; cin \\( \\gg \\) phone_num; // Your codes for B1 should be inserted here return 0 ; \\} Sample output 1: Enter 8-digit phone number: 35124859 Fixed-line Sample output 2: Enter 8-digit phone number: 60125547 Mobile Sample output 3: Enter 8-digit phone number: 41242252 Invalid Sample output 4: Ente

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David M. Kroenke

1st Edition

0130086509, 978-0130086501

More Books

Students also viewed these Databases questions