Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

c + + n a loop, the app should prompting the user to enter a pair of numbers on the same line: a whole number

c++ n a loop, the app should prompting the user to enter a pair of numbers on the same line: a whole number index and its corresponding floating point value. Do not validate index input in the app. Quit the loop when an uppercase or lowercase Q is entered for either the index or the value. Indexes can be entered in any order
-
-
they don't have to start with zero and go up by one thereafter. It's whatever the user enters.
Your app should keep track of which indexes got entered. Use a bool DynamicArray for that. After all data entry is complete, the app should:
output how many
(
unique
)
indexes got entered,
output the list of all used indexes and their values, per the example below, and
implement an event
-
controlled loop that prompts for an index value and outputs whether the index is in use or not, and if in use, what is the value stored for that index. Loop until the user elects to stop by entering uppercase or lowercase Q
.
Here's a sample of how this should work
(
user input in blue
)
:
Input an index and a value
[
Q to quit
]
:
3
3
1
.
2
Input an index and a value
[
Q to quit
]
:
4
1
0
0
Input an index and a value
[
Q to quit
]
:
5
3
0
0
Input an index and a value
[
Q to quit
]
: x
1
.
7
Input an index and a value
[
Q to quit
]
:
3
3
1
2
0
Input an index and a value
[
Q to quit
]
:
-
1
2
3
.
4
Input an index and a value
[
Q to quit
]
:
2
0
0
0
-
9
9
9
.
9
Input an index and a value
[
Q to quit
]
: q
You stored this many values:
5
The index
-
value pairs are:
0
=
>
1
.
7
4
=
>
1
0
0
5
=
>
3
0
0
3
3
=
>
1
2
0
2
0
0
0
=
>
-
9
9
9
.
9
Input an index for me to look up
[
Q to quit
]
:
3
3
Found it
-
-
the value stored at index
3
3
is
1
2
0
Input an index for me to look up
[
Q to quit
]
:
0
Found it
-
-
the value stored at index
0
is
1
.
7
Input an index for me to look up
[
Q to quit
]
:
-
1
0
Sorry, but there is no value stored at index
-
1
0
Input an index for me to look up
[
Q to quit
]
:
3
8
Sorry, but there is no value stored at index
3
8
Input an index for me to look up
[
Q to quit
]
:
1
0
0
0
0
Sorry, but there is no value stored at index
1
0
0
0
0
Input an index for me to look up
[
Q to quit
]
:
2
0
0
0
Found it
-
-
the value stored at index
2
0
0
0
is
-
9
9
9
.
9
Input an index for me to look up
[
Q to quit
]
: q
Design the prompts and the output formatting as you like.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Apply entertainment-education for social initiatives.

Answered: 1 week ago

Question

12=15 7 'S. 08 02. the S by e 'o

Answered: 1 week ago