Answer to Question #54419 in C++ for nia

Question #54419
Write a C++ program for Cell phone pin number. If the user entered the correct pin code displays.Welcome to Smart.Simply Amazing. The cell phone user will enter his pin code three times; if onthe first, second and third trial he failed to enter the correct pin code it will display code three times also.If the user still failed to enter PUK code will display "SIM BLOCKED".
1
Expert's answer
2015-09-02T05:47:53-0400
#include <iostream>
using namespace std;

int main()
{
int pincode=1234;
int puckcode=123456;
int userpin =0;
int userpuck = 0;
int attempt = 1;
bool statuspin=false;
bool statuspuck=false;

while(statuspin==false){
do{
cout<<"\nPlease enter pin code: ";
cin>>userpin;
if (userpin!=pincode) {cout<<"Pin Code wrong"<<endl;}
else {cout<<"welcome to SMART"<<endl;statuspin=true;break;}
attempt++;
}while(attempt<4);
if (statuspin==true) break;

cout<<"\nPlease enter PUCK CODE: ";
cin>>userpuck;
if (userpuck!=puckcode) {cout<<"Phone Blocked";statuspin=true;break;};
};

}






Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS