quiz حل الأسئلة الجامعية manage_search الأرشيف

تم الحل ✓
categoryهندسة الحاسبات schoolبكالوريوس event_available2026-07-15

السؤال

Transcribed Image Text:

Write a C++ program that performs the following: (40 points) Prints on screen a selection menu as follow: a. Calculations. (13 points) b. series, sum perfects and draw. (13 points) c. 2 D Array. (13 points) (1 point) d. Exit. (marks will be distributed equally between the branches of each main point except the last branch) a. If user presses a or A, the following sub menu should be displayed: 1- If user presses 1. Write a code that will allow the user to enter three integers and order these integers from smallest to largest using functions. (Use function to enter the three integer numbers by the user and another function that receives the three integers and order them). 2- If user presses 2. The sum of the last and first digits: write a function that finds the sum of the first and last digits of any entered integer number by the user as the following example: x=1267, sum digits = 8). 3- If user presses 3, Max Prime: Write a function that reads in 10 prime numbers, then the program should find and print out the maximum prime number. (Any non-prime number will not be counted from the entered numbers). Hint: Use continue statement. 4- If user presses 4, Return to the main menu. b. If user presses b or B, the following sub menu should be displayed: 1- If user presses 1, program should call a function that finds series result: write a function which prints out the result of F2=1+x²/(x-1)² + x²/(x-1)³ + x³ /(x-1) 4 + x/(x-1)+1 (note that you should define a function to calculate the power). 2- If user presses 2, Sum Perfects: write a function that finds the sum of the perfect numbers from 1 to N 3- Note: N should be positive and more than 1. 4. If user presses 3, Draw Triangle: (Function should take the number of rows from the user and draws the following triangular shape using recursion). Please enter the number of rows 9 5- If user presses 4. Return to the main menu. C. If user presses c or C, the following sub menu should be displayed (note that these branches are related with each other): 1- If user presses 1. print the elements of the created matrix, Define 2D array: Fill it with random numbers ranged between [-20 200] (a function in C++ which accepts a 2D array of integers and its size as arguments. [Assuming the 2D Array to be a square matrix with odd dimension i.e. 3x3, 5x5, 7x7 etc...]. Example, of the array contents are: 354 769 2 18 2- If user presses 2. Print the sum of the left diagonal elements of the array created in the first branch using function. 3- If user presses 3. Print the factorial of the maximum odd number in the array crated in the first branch using functions. 4. If user presses 4, Return to the main menu. To Exit press e or E.

check_circle الجواب — حل مفصل خطوة بخطوة

hourglass_top