QuestionQuestion

# Introduction
You are provided with ten versions of the program "ranger". Five of them are C++ implementations, and five are compiled executables.

Your task is to determine which of these 10 programs is correct, and to match source code to executable.

## Documenting Your Answers
You may use the provided text file start.txt as a starting point for your submitted answer.

### Source Code
For the source code programs, please indicate the following for each program

A) Determine if the program is CORRECT or INCORRECT
B) if incorrect, provide the line number or line numbers which are causing the error, explain what is wrong with that code.
C) if incorrect, provide the input / output sequence that confirms the program is incorrect.

### Executables
For the compiled programs, please indicate the following for each program

1) Determine if the program is CORRECT or INCORRECT
2) If incorrect, provide the input / output sequence that confirms the program is incorrect.

### Matching
Exactly three of your source code programs have been compiled and are included in your executables.

Determine which source code files match to which of the executables.

# Program Description
The following program is called ranger.cpp and here is its spec:

Read three parameters from the command line (the count N, the range bottom B, and the range top T). Then, read from standard input N integers. The range is all those numbers n
satisfying B ≤ n ≤ T , i.e. all the numbers from B to T inclusive. Produce a report about those N integers.

All of the input numbers that are outside of the range should be printed on one line, with spaces in between. On the next line, all the numbers from the range that were missing from the input should be printed.

For both cases, the phrase “out of range:” or “missing:” should precede the appropriate list of numbers. If either category of numbers is empty, “None” should be printed in place of the numbers.

## Other specifications:
1. If one of the values N, B, or T is missing, the program should exit with return code 42.

2. If there are extra command line arguments, the program should exit with return code 43.

3. The numbers N, B, and T (when present on the command line) are correctly formatted integers; no error handling is required (but it is not forbidden to do error handling for this case).

4. No error checking is required for the reading of integers from standard input (but it is not forbidden to do so).

## Examples of correct input / output sequences
Example 1:
```
>ranger 3 5 8
6 7 12
out of range: 12
missing: 5 8
```
Example 2:
```
>ranger 4 10 12
12 11 1 10
out of range: 1
missing: None
```
Example 3:
```
>ranger
?42
```
Note: in zsh, this means the return code was 42.

Example 4:
```
>ranger 3 10 12
4 5 6
out of range: 4 5 6
missing: 10 11 12
```
Example 5:
```
>ranger 3 10 12                                       
11 12 10
out of range: None
missing: None
```
## Examples of incorrect input / output sequences

```
>ranger 5 1 4
0 1 2 4
out of range: 0 1 4
missing: 3
```
Why incorrect? 1 and 4 are part of the range.

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

    SOURCE/PROGRAM evaluation

(for your convenience, the names of the files are provided below)

ranger_Oscar.cpp
ranger_Bravo.cpp
ranger_Alfa.cpp
ranger_Lima.cpp
ranger_Foxtrot.cpp
ranger_Sierra
ranger_Zulu
ranger_Kilo
ranger_Victor
ranger_November

--------------------------
ranger_Oscar.cpp
--------------------------
A) CORRECT / INCORRECT ?
Correct, I've tested it on several examples given in the description.
The produced output is the same as given there.
Also, while observing the code, I noticed the return arguments in values of 42 and 43 when one of N, B, T values is missing or a value more is given.
So, I think the incorrect input is also threaten properly.

--------------------------
ranger_Bravo.cpp
--------------------------
A) CORRECT / INCORRECT ?
Incorrect, the program crashes when we want to run it without all arguments given.
To be more clear, I tried running the program with N and B given only, it crashed instead of returning the value of 42.
I also tried running with N, B, T and some random argument given, the program ran correctly after entering values within N.
That is also incorrect. In such cases, the value 43 has to be returned

B) ERROR LINE(S)
Line 22: int N{ stoi(argv[1]) }, bottom{ stoi(argv[2]) }, top{ stoi(argv[3]) };
Exception thrown at 0x795BFF80 (ucrtbased.dll) in ranger_Bravo.exe: 0xC0000005: Access violation reading location 0x00000000.

C) INPUT/OUTPUT
input: 3 5
output: the program crashes

input:...

By purchasing this solution you'll be able to access the following files:
Solution.txt.

$15.00
for this solution

or FREE if you
register a new account!

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available C-Family Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats