السلام عليكم ورحمه الله وبركاته
اتمنى منكم مساعدتي في حل البرامج التاليه
البرنامج الاول.....
Problem 1:
Write a C++ program that reads array values from the user until he presses CTRL+D key and then determines the length of the array and the minimum value.
Note:
- Define the max size of the array to be 30;
- Define a function called Min that returns the minimum value of array elements.
البرنامج الثاني...
Problem 2:
Write and examine the function int frequency( int a [ ], int n, int x ); this function calculate the number of occurrence of entered element x in the n elements of array a; and return it as a number of occurrence of x element in n.
Note:
- Examine your program with array with this initializer list:
double a[ ] = { 651, 508, 400, 301, 329, 599, 455, 400, 346, 346, 329, 375, 561, 390, 399, 400, 401, 561, 405, 405, 455, 508, 473, 329, 561, 505, 329, 455, 561, 599, 561, 455, 346, 301, 455, 561, 399, 599, 508, 508};
- Define a Print function that prints array elements before entering element value.
البرنامج الثالث...
Problem 3:
Define class called Operations which has the following:
1. Private data member Num
2. Set and Get member functions which allow assigning and returning data member in the class. [Hint: in set function you should use Validate(int) member function]
3. A Constructor function that initializes the data member by using set function.
4. Define a member function Factorial() that returns the factorial of data member
Factorial n!=n(n-1)(n-2)..(2)(1)
5. Define member function Fraction() that print integer number from 1 to n with its fraction [Hint: use nested For loop]
e.g. if Num=3
1
1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9,
2
2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9,
3
3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9,
6. Define member function Validate(int) that validate the integer if it is positive and grater than 1 or not, if not prompt the user to reenter it again and then return the correct positive number.
[Hint: Validate(int) should used by set member function before setting data member to any value – use While loop]
7. Test your function in the main function.
8. The program should contains Two files
- <LI class=MsoNormal style="MARGIN: 0cm 0cm 0pt; mso-list: l0 level1 lfo1; tab-stops: list 36.0pt">Header file:- which contain declaration of private (data members) and public (member functions) with its definitions.
- Source File: - which contain the main function
وشكرا...اتمنى منكم المساعد وبسرررعه
