2. Find the ring! by CodeChum Admin Thanks to you, my crush was impressed with my awesome display() function!! I'm now planning to propose to her, but I need to find the best ring available in the market as she is truly special to me. Can you help me find the ring that she wants? Instructions: In the code editor, you are provided with the main() function that asks the user for 10 elements that represents the options for the ring as well as a single integer value that represents the ring that she wants. Then, a call to the findRing() function is made and the array of rings and the ring she wants are passed into it. Your task is to implement the findRing() function. This has the following details: Return type - int Name - findRing Parameters int* - for the array of rings int - size of the array of rings int - the ring that she wants Return value - the index of the ring in the array of rings. It is guaranteed that there is only one such ring that matches the ring that she wants. Input 1. Ten integer values representing the rings 2. Integer value representing the ring she wants Output Enter·option·#1:·5 Enter·option·#2:·3 Enter·option·#3:·10 Enter·option·#4:·9 Enter·option·#5:·13 Enter·option·#6:·11 Enter·option·#7:·20 Enter·option·#8:·25 Enter·option·#9:·4 Enter·option·#10:·3 Enter·the·ring·she·wants:·25 Ring·25·is·found·at·option·8!
2. Find the ring! by CodeChum Admin Thanks to you, my crush was impressed with my awesome display() function!! I'm now planning to propose to her, but I need to find the best ring available in the market as she is truly special to me. Can you help me find the ring that she wants? Instructions: In the code editor, you are provided with the main() function that asks the user for 10 elements that represents the options for the ring as well as a single integer value that represents the ring that she wants. Then, a call to the findRing() function is made and the array of rings and the ring she wants are passed into it. Your task is to implement the findRing() function. This has the following details: Return type - int Name - findRing Parameters int* - for the array of rings int - size of the array of rings int - the ring that she wants Return value - the index of the ring in the array of rings. It is guaranteed that there is only one such ring that matches the ring that she wants. Input 1. Ten integer values representing the rings 2. Integer value representing the ring she wants Output Enter·option·#1:·5 Enter·option·#2:·3 Enter·option·#3:·10 Enter·option·#4:·9 Enter·option·#5:·13 Enter·option·#6:·11 Enter·option·#7:·20 Enter·option·#8:·25 Enter·option·#9:·4 Enter·option·#10:·3 Enter·the·ring·she·wants:·25 Ring·25·is·found·at·option·8!
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
2. Find the ring!
by CodeChum Admin
Thanks to you, my crush was impressed with my awesome display() function!!
I'm now planning to propose to her, but I need to find the best ring available in the market as she is truly special to me.
Can you help me find the ring that she wants?
Instructions:
- In the code editor, you are provided with the main() function that asks the user for 10 elements that represents the options for the ring as well as a single integer value that represents the ring that she wants. Then, a call to the findRing() function is made and the array of rings and the ring she wants are passed into it.
-
Your task is to implement the findRing() function. This has the following details:
- Return type - int
- Name - findRing
-
Parameters
- int* - for the array of rings
- int - size of the array of rings
- int - the ring that she wants
- Return value - the index of the ring in the array of rings. It is guaranteed that there is only one such ring that matches the ring that she wants.
Input
1. Ten integer values representing the rings
2. Integer value representing the ring she wants
Output
Enter·option·#1:·5
Enter·option·#2:·3
Enter·option·#3:·10
Enter·option·#4:·9
Enter·option·#5:·13
Enter·option·#6:·11
Enter·option·#7:·20
Enter·option·#8:·25
Enter·option·#9:·4
Enter·option·#10:·3
Enter·the·ring·she·wants:·25
Ring·25·is·found·at·option·8!
![main.c
+ c
Test Cases
Enter option #1: 5
1 #include<stdio.h>
Enter option #2: 3
2
Enter option #3: 10
// TODO: Declare the findRing() here
ÇE Run Tests
Enter option #4: 9
Enter option #5: 13
int main(void) {
int rings[10];
Enter option #6: 11
Test Case
Enter option #7: 20
8
1
for(int i = 0; i < 10; i++) {
printf("Enter option #%d: "
scanf("%d", &rings[i]);
}
Enter option #8: 25
9 -
Enter option #9: 4
10
i + 1);
11
Enter option #10: 3
12
Test Case
Enter the ring she wants: 25
13
int wantedRing;
printf("Enter the ring she wants: ");
scanf("%d", &wantedRing);
14
Ring 25 is found at option 8!
15
16
17
Test
18
printf("\nRing %d found at option %d!", wantedRing, findRing(r
O Case
Hidden
19
20
return 0;
3
Score: 0/10
21 }
22
HN34 in67](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F82304115-cf1d-40b3-864e-0ed64499952f%2F6f10acd5-db47-447c-a8ea-3c574dd82fa1%2Fsaxxyn3a_processed.png&w=3840&q=75)
Transcribed Image Text:main.c
+ c
Test Cases
Enter option #1: 5
1 #include<stdio.h>
Enter option #2: 3
2
Enter option #3: 10
// TODO: Declare the findRing() here
ÇE Run Tests
Enter option #4: 9
Enter option #5: 13
int main(void) {
int rings[10];
Enter option #6: 11
Test Case
Enter option #7: 20
8
1
for(int i = 0; i < 10; i++) {
printf("Enter option #%d: "
scanf("%d", &rings[i]);
}
Enter option #8: 25
9 -
Enter option #9: 4
10
i + 1);
11
Enter option #10: 3
12
Test Case
Enter the ring she wants: 25
13
int wantedRing;
printf("Enter the ring she wants: ");
scanf("%d", &wantedRing);
14
Ring 25 is found at option 8!
15
16
17
Test
18
printf("\nRing %d found at option %d!", wantedRing, findRing(r
O Case
Hidden
19
20
return 0;
3
Score: 0/10
21 }
22
HN34 in67
![main.c
< >
+ c
Test Cases
Enter option #1: 5
3 // TODO: Declare the findRing() here
Enter option #2: 3
4
Enter option #3: 10
ÇE Run Tests
Enter option #4: 9
6
int main(void) {
Enter option #5: 13
7
int rings[10];
8
Enter option #6: 11
Test Case
for(int i = 0; i < 10; i++) {
printf("Enter option #%d: ", i + 1);
scanf("%d", &rings[i]);
}
9 -
V.
Enter option #7: 20
1
10
Enter option #8: 25
11
Enter option #9: 4
12
Enter option #10: 3
13
int wantedRing;
printf("Enter the ring she wants: ");
scanf("%d", &wantedRing);
14
Test Case
Enter the ring she wants: 25
15
2
16
Ring 25 is found at option 8!
17
18
printf("\nRing %d found at option %d!", wantedRing, findRing(r
19
Test
20
return 0;
O Case
Hidden
21 }
3
22
Score: 0/10
23 // TODO: Define the findRing() here
>](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F82304115-cf1d-40b3-864e-0ed64499952f%2F6f10acd5-db47-447c-a8ea-3c574dd82fa1%2Foqbmzuo_processed.png&w=3840&q=75)
Transcribed Image Text:main.c
< >
+ c
Test Cases
Enter option #1: 5
3 // TODO: Declare the findRing() here
Enter option #2: 3
4
Enter option #3: 10
ÇE Run Tests
Enter option #4: 9
6
int main(void) {
Enter option #5: 13
7
int rings[10];
8
Enter option #6: 11
Test Case
for(int i = 0; i < 10; i++) {
printf("Enter option #%d: ", i + 1);
scanf("%d", &rings[i]);
}
9 -
V.
Enter option #7: 20
1
10
Enter option #8: 25
11
Enter option #9: 4
12
Enter option #10: 3
13
int wantedRing;
printf("Enter the ring she wants: ");
scanf("%d", &wantedRing);
14
Test Case
Enter the ring she wants: 25
15
2
16
Ring 25 is found at option 8!
17
18
printf("\nRing %d found at option %d!", wantedRing, findRing(r
19
Test
20
return 0;
O Case
Hidden
21 }
3
22
Score: 0/10
23 // TODO: Define the findRing() here
>
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON

Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education