Question: in c plus #include using namespace std; / * * A simulated lock with digit buttons. * / class Lock { public: / * *
in c plus #include
using namespace std;
A simulated lock with digit buttons.
class Lock
public:
Simulates a digit button push.
@param button a digit
void pushint button;
Simulates a push of the open button.
@return true if the lock opened
bool open;
private:
int combination ;
int input ;
;
void Lock::pushint button
Your code goes here
bool Lock::open
Your code goes here
int main
Lock mylock;
mylock.push;
mylock.push;
mylock.push;
mylock.push;
cout "Combination: endl;
cout boolalpha;
cout "Expected: false" endl;
cout "Your output: mylock.open endl endl;
mylock.push;
mylock.push;
mylock.push;
mylock.push;
cout "Combination: endl;
cout "Expected: true" endl;
cout "Your output: mylock.open endl endl;
mylock.push;
mylock.push;
mylock.push;
cout "Combination: endl;
cout "Expected: false" endl;
cout "Your output: mylock.open endl endl;
mylock.push;
cout "Combination: endl;
cout "Expected: false" endl;
cout "Your output: mylock.open endl endl;
mylock.push;
mylock.push;
mylock.push;
mylock.push;
cout "Combination: endl;
cout "Expected: true" endl;
cout "Your output: mylock.open endl;
return ;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
