Final Exam Program Solution

$35.00 $24.00

In this assignment, you will iteratively populate a fixed-size integer array of 10 elements,   array_a, with integer values provided by scanf. The user will enter 10 positive integer values, one per line, and the program will store the 10 values in array_a[0], array_a[1], …, array_a[9]. Once the 10 integers are entered, your program will…

You’ll get a: . zip file solution

 

 
Categorys:

Description

5/5 – (2 votes)

In this assignment, you will iteratively populate a fixed-size integer array of 10 elements,

 

array_a, with integer values provided by scanf. The user will enter 10 positive integer values,

one per line, and the program will store the 10 values in array_a[0], array_a[1], …,

array_a[9]. Once the 10 integers are entered, your program will print the array, then prompt

the user for a search value which may or may not exist in the array. If the value exists, your

program must print all locations where the value is stored. If the value does not exist in the

array, it will display the message “that value does not exist in the array!”. After all output has

 

been displayed, the program should exit (do not prompt for additional input).

 

Input will be entered by the user in the following form:

 

<VALUE_0><ENTER>

 

<VALUE_1><ENTER>

<VALUE_2><ENTER>

<VALUE_3><ENTER>

<VALUE_4><ENTER>

<VALUE_5><ENTER>

<VALUE_6><ENTER>

<VALUE_7><ENTER>

<VALUE_8><ENTER>

<VALUE_9><ENTER>

 

Once all of the input is entered, output will be printed in the following format (where <VALUE_X> is one of the integers provided by the user):

 

array_a[0] = <VALUE_0>

 

array_a[1] = <VALUE_1>

array_a[2] = <VALUE_2>

array_a[3] = <VALUE_3>

array_a[4] = <VALUE_4>

array_a[5] = <VALUE_5>

array_a[6] = <VALUE_6>

array_a[7] = <VALUE_7>

array_a[8] = <VALUE_8>

array_a[9] = <VALUE_9>

 

Next, the prompt for a search value will be given, and input will be accepted in the following form:

 

ENTER A SEARCH VALUE: <VALUE_Y><ENTER>

 

Which will then print all of the array indices containing that value, one per line, or the constant string

 

“that value does not exist in the array!”.

 

For example, output when the user enters {1, 1, 2, 3, 4, 5, 6, 1, 7, 8} for the array values and “1” for the search value should be displayed as follows:

 

array_a[0] = 1

 

array_a[1] = 1

array_a[2] = 2

array_a[3] = 3

array_a[4] = 4

array_a[5] = 5

array_a[6] = 6

array_a[7] = 1

array_a[8] = 7

array_a[9] = 8

ENTER A SEARCH VALUE: 1

 

array_a[0] = 1

 

array_a[1] = 1

 

array_a[7] = 1

 

If the user instead were provide “99” for the search value, output should be displayed as follows:

array_a[0] = 1

 

array_a[1] = 1

array_a[2] = 2

array_a[3] = 3

array_a[4] = 4

array_a[5] = 5

array_a[6] = 6

array_a[7] = 1

array_a[8] = 7

array_a[9] = 8

ENTER A SEARCH VALUE: 99

That value does not exist in the array!

 

Points will be assigned as follows (40 points total corresponding to 40 out of 100 possible points on the final exam):

 

  1. Program accepts and displays 10 integers in the proper format (10 points)

 

  1. Program prompts and accepts the user search value successfully (10 points)
  2. Program displays all cases when the search value is in the array (15 points)
  3. Program displays the proper output when the search value does not exist (5 points)

 

Submit your solution as a single “.s” file to Blackboard. Name the file “abc1234_pfinal.s”, where abc1234 is your UTA NetID.

 

*** Be sure to check http://github.com/cmcmurrough/cse2312 for useful code snippets ***