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
Meteoroids are small space rocks. They are usually pieces of asteroids or comets. Meteoroids orbit the sun like asteroids and co
Angelina_Jolie [31]
B is your answer meteoroids are small space rocks they are usually pieces of asteroids or comets
4 0
3 years ago
Using the College Registration example from Section 6.7.3 as a starting point, do the following:
andreev551 [17]

Answer:

Check the explanation

Explanation:

INCLUDE Irvine32.inc

TRUE = 1

FALSE = 0

.data

gradeAverage WORD ?

credits WORD ?

oKToRegister BYTE ?

str1 BYTE "Error: Credits must be between 1 and 30" , 0dh,0ah,0

main PROC

call CheckRegs

exit

main ENDP

CheckRegs PROC

push edx

mov OkToRegister,FALSE

; Check credits for valid range 1-30

cmp credits,1 ; credits < 1?

jb E1

cmp credits,30 ; credits > 30?

ja E1

jmp L1 ; credits are ok

; Display error message: credits out of range

E1:

mov edx,OFFSET str1

call WriteString

jmp L4

L1:

cmp gradeAverage,350 ; if gradeAverage > 350

jna L2

mov OkToRegister,TRUE ; OkToRegister = TRUE

jmp L4

L2:

cmp gradeAverage,250 ; elseif gradeAverage > 250

jna L3

cmp credits,16 ; && credits <= 16

jnbe L3

mov OkToRegister,TRUE ; OKToRegister = TRUE

jmp L4

L3:

cmp credits,12 ; elseif credits <= 12

ja L4

mov OkToRegister,TRUE ; OKToRegister = TRUE

L4:

pop edx ; endif

ret

CheckRegs ENDP

END main

3 0
3 years ago
Explain why you cannot the Apple OS install on a regular windows computer and vice versa, without the aid of a virtualization so
Phoenix [80]

Answer:

The reason is due to proprietary design of the Operating System (OS) which require a virtualization software to blanket or "disguise" the hardware (processor) borderlines of the computer onto which it is to be installed.

Explanation:

An Apple system that has the RISC processor and system architecture which has an operating system made entirely for the Apple system architecture

If the above Apple OS is to be installed on a windows computer, then the procedure to setup up the OS has to be the same as that used when on an Apple system, hence, due to the different processors and components of both systems, a virtualization will be be needed to be provided by a Virtual box, Parallels desktop or other virtualization software.

6 0
3 years ago
What is the use of an NDP?
Makovka662 [10]

Answer:

It defines five ICMPv6 packet types for router solicitation,router advertisement,neighbor solicitation,neighbor advertisement,and network redirects.

Explanation:

8 0
3 years ago
John was teaching his students about the basics of computer hardware and software. By the end of his lecture, he asked his class
vredina [299]
A CPU is the electronic circuitry within a computer that carries out the instructions of a computer program by performing basic arithmetic logical, control and input/output operations specified by the instructions.
Knowing this, the answer is both C - That it coordinates the flow of instructions and data within computers, And A - That a control unit performs arithmetical and logical computations.
If you can only select one answer, I'd personally go with A.
4 0
3 years ago
Read 2 more answers
Other questions:
  • In three to five sentences, describe how you can organize written information logically and sequentially
    8·1 answer
  • Which part of the cryosphere comes directly from the atmosphere?
    13·2 answers
  • A text-only forum accessed through a bulletin board service (BBS) is known as a _____.
    14·1 answer
  • I'm using my PS4 dual shock controller to connect to the fire stick on the tv so I can play games with it but whenever I try to
    10·1 answer
  • The syntax for accessing a class (struct) member using the operator -&gt; is ____.
    15·2 answers
  • Enter a formula using a database function to calculate the total value in the Cost column for expenses that meet the criteria in
    12·1 answer
  • An optimal solution to a linear programming problem MUST lie A. somewere on the line between two corner points. B. somewhere out
    12·1 answer
  • A person appreciation of a food taste and flavor is commonly referred to as what
    14·1 answer
  • Which tab is used to insert a hyperlink onto a slide?
    9·1 answer
  • What are the advantages of customer relationship managment​
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!