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
deff fn [24]
3 years ago
7

Your smartphone or tablet may require you to enter a short personal identification number, or PIN. This may be any number in a r

ange of lengths. For our purposes, we will consider PINs to be of length 4, 5, or 6. We use digits 0–9 inclusive. Since PINs can be of different lengths, you need to consider 1111, 01111, and 001111 as separate examples. We provide a testing function check_pin( pin ) which accepts a four-digit guess for pin. check_pin returns True if the PIN number matches the internal PIN. The pin should be provided as a string, that is, '1234', rather than [ '1','2','3','4' ] or [ 1,2,3,4 ]. Compose a function crack_pin() which scans all possible PIN numbers in the valid ranges and returns the correct one. Your submission should include a function crack_pin(). check_pin is already defined for your use.
Computers and Technology
1 answer:
matrenka [14]3 years ago
8 0

Answer:

#include <iostream>

using namespace std;

void crack_pin(string a, int low, int res)

{

if (low == res)

 cout<<a<<endl;

else

{

 for (int i = low; i <= res; i++)

 {

  swap(a[low], a[i]);

  crack_pin(a, low+1, res);

  swap(a[low], a[i]);

 }

}

}

int main()

{

string str = "ABC";

cout <<"Enter pin guess"<<endl;

getline(cin,str);

int n = str.size();

crack_pin(str, 0, n-1);

return 0;

}

Explanation:

Take pin guess  from user using getline method in str variable of type string.

Find size of pin guess.

Declare a function crack_pin and send string, starting (0) and ending (n-1) to function.Call the function recursively to find all combinations.If start=end print string else call function again.

You might be interested in
The type of meter used to test downstream digital signal quality
Levart [38]
I would say digital modulated signals  <span />
3 0
4 years ago
Determining Uses for Outer Joins
Ilia_Sergeevich [38]

Answer:

a query that shows all customers, whether or not they placed an order

Explanation:

EDG 21

4 0
3 years ago
The signal for a turn should be made at least ______ feet before yo wish to make the turn
LenKa [72]

100 feet away before turning.

7 0
4 years ago
What command should you use to rearrange parts of files on the drive so they are contiguous?
Sunny_sXe [5.5K]
<span>What command should you use to rearrange parts of files on the drive so they are contiguous? Answer = Defrag</span>
3 0
4 years ago
Explains your analysis of the impacts of this new internet distribution on people and businesses.
Anika [276]

Answer:

A business' ability to communicate with its employees, customers and associates changed dramatically when the Internet yielded new communication tools. Email and instant messaging have changed the face of business communication.

8 0
2 years ago
Other questions:
  • PLZ HELP ASAP!!!
    10·1 answer
  • Each peripheral device has its own software, called a(n) ____, which contains the detailed instructions required to start that d
    6·1 answer
  • 4. When emergency changes have to be made to systems, the system software may have to be modified before changes to the requirem
    13·1 answer
  • Assume that x is a char variable that has been declared and already given a value . write an expression whose value is true if a
    8·1 answer
  • Which of the following modes of replication requires a very low latency network connection and ensures data remains in synch wit
    13·1 answer
  • What can your employer do to protect you from overhead power lines?
    13·1 answer
  • How is “compromise" defined in the context of information technology and Select one answer.
    5·2 answers
  • What makes manually cleaning data challenging?
    15·1 answer
  • For a company, intellectual property is _______________.
    5·2 answers
  • Giusp minfg gấp vs ạ đáp án thôi nhé
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!