The Same Instructions As For Assignment 1 Is Applied Here. Please Submit To Your Lecturer Anytime Between 3 To6 May 2016
The Same Instructions As For Assignment 1 Is Applied Here. Please Submit To Your Lecturer Anytime Between 3 To6 May 2016
1. The easiest way to solve simultaneous equations is to use Cramers Rule. Using arrays
to store the coefficients of the equations, write a complete C++ program that uses
Cramers Rule to solve the following equations:-
7x + 5y -3z = 16
3x 5y + 2z = -8
5x + 3y -7z =0
Hint:- http://www.purplemath.com/modules/cramers.htm
2. Write a complete C++ program that generates 20 random numbers in the range of 50 to
250 and store these numbers in an array called number. Then the program sort the
numbers into ascending order using the bubble sort method and store it in an array
called sort. The array number must not be altered during the process. The program
then print both arrays side by side.
Hint:- http://mathbits.com/MathBits/CompSci/Arrays/Bubble.htm
3. Write a complete C++ program that read a maximum of 30 numbers from the user, and
store the numbers into an array called value. The program then print all the numbers
in the array that is divisible by 3 or 4. The program uses a function called divisible( )
to determine whether the number is divisible by 3 or 4. Write the program using pass
by value method when calling the function. Then modify the program by changing the
function call method to pass by reference method.
*There will be two programs for this question.