Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please solve using c++ ....question 2 is the same question but in functions ... Write a C++ program to perform the following tasks: a) Declare

please solve using c++ ....question 2 is the same question but in functions ...
image text in transcribed
image text in transcribed
Write a C++ program to perform the following tasks: a) Declare two parallel arrays, namely studid and studage, both of int type and of size 50 . b) Using one of the repetition control structures, read from the user 10 values in the studid array (each of 4 digits), and 10 values in the studage array (each of 2 digits). c) Display a menu with the following options: 1. Find a student 2. Delete a student 3. Print the report 4. Stop d) After displaying the menu, ask the user to enter one of the above options. e) If the option is incorrect (not in the range of 1 to 4), give an error message and redisplay the menu again. t) The task to be performed for each of the above options is as follows: - For Option 1: i. Get the student id from the user on the screen ii. Use a loop to compare the values in the array studid with the id provided by the user. iii. When found, print on the screen the student id and the student aga, with suitable messages. iv. Else inform the user that the id was not found. - For Option 2: i. Get the student id from the user on the screen ii. Use a loop to compare the values in the array studid with the id provided by the user. iii. When found, replace the id and the age with zeros, at the same location in both arrays. iv. Else inform the user that the id was not found. - For Option 3: Print the student id and age for all students, each pair on a separate line, with proper headings as shown in the input/output example. - For Option 4: Exit the program. For options 1, 2, 3, implement the option and repeat the process of displaying the menu again. Now solve the same problem of Question 1 BUT using functions. You should have at least 4 functions to implement the tasks described below. As a helping hint: you may declare the arrays studid and studage as global arrays (outside the main and other functions, for example before the main() function). In this way you do not have to pass them as parameters. The decision is yours. You may also make all these function void but it is your decision. 1. Function ReadData to read from the user the values for the arrays studid and studage. 2. Function FindStud to implement the option 1 of the menu. 3. Function DeleteStud to implement the option 2 of the menu. 4. Function PrintReport to implement option 3 of the menu

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

Fundamentals Of Database Systems

Authors: Ramez Elmasri, Shamkant B. Navathe

7th Edition Global Edition

1292097612, 978-1292097619

More Books

Students also viewed these Databases questions

Question

What is the most important part of any HCM Project Map and why?

Answered: 1 week ago