Question
write a program IN BASIC C code that calls 6 different recursive functions: 1. randomArray() - Takes an array and its size. Sets each element
write a program IN BASIC C code that calls 6 different recursive functions:
1. randomArray() - Takes an array and its size. Sets each element of the array to a random integer between -999 and 1000 inclusive.
2. findMin() - Takes an array and its size. Returns the minimum value in the array.
3. findMax() - Takes an array and its size. Returns the maximum value in the array.
4. reverseArray() - Takes an array and its size. Reverses the array. The value in the last element is put in the first element, the value in the second last element is put in the second element and so on.
5. fPrintArray() Takes a file pointer, an array and its size. Prints out the array, one element per line to the file pointed at by the file pointer.
6. reverseFile() Takes two file pointers. Writes the second file such that it contains the same elements as the first file, but in reverse order.
In your main(),
Ask the user for a positive integer. Use it to seed the random number generator.
Generate a random number between 5 and 20 inclusive. Use function randomArray() to generate that many random numbers and store them in an array. Print out the number of elements in the array.
Use functions findMin() and findMax() to print out the minimum and maximum values in the array.
Use function reverseArray() to reverse the array.
Use fPrintArray() to print out to the console the contents of the array before and after reversing the array.
Generate a random number between 10 and 100 inclusive. Use function randomArray() to generate that many random numbers and store them in an array.
Use function fPrintArray() to write these newly generated random numbers to a file hw12in.txt. Print out the number of entries in the file.
Use function reverseFile() to reverse the file hw12In.txt to the file hw12Out.txt.
Do not use any while or for statements in your program, everything should be done recursively.
IN BASIC C programing
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started