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

Section 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: Enter 8-digit phone number: 545678 Incorrect format. Re-enter: 545678912 Incorrect format. Re-enter: 54567891 Fixed-line (12 marks) Page 6 of 14
in c++  Section B (36%) - Short Questions Answer ALL questions in this

Section B (36%) - Short Questions Answer ALL questions in this section in the answer book provided. Fach 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 enterod 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 "imvalid" number (other cases). \#friclude Ciostream? using famespace atd? int main () Int phone tum: cout "Enter 8-digit phone number: " ? cin phone num? // Your codes for B1 should be inserted here return 0; 1 Sample output I: Enter 8-digit phone number: 35124859 Fixed-1ine Sample output 2: Fnter 8-digit phone number: 60125547 Mobile Sample output 3 : Enter 8-digit phone number: 41242252 Imvalid Sample output 4: Sampicoutput 4: Enter 8-difit phone number: 545678 Incorrect Cormat. Re-enter: 545678912 Incorrect format. Re-enter: $4567891 Fixed-ine (12 marks) Page 6 of 14

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!