use only C progamming not CFunction void STOREEVENDATA int n

use only C progamming (not C++)Function void STORE_EVEN_DATA (int n, int min, int max) opens a file “LAB.txt” and writes in it even random numbers which are within min and max. This function is allowed to attempt to generate random numbers only n times. 2. “main” gets user inputs for how many attempts (n) function STORE_EVEN_DATA (..) will be allowed to make in order to generate even random numbers, and what are the lowest (int min) and highest (int max) limits for the random numbers to be generated. The “main” then calls STORE_EVEN_DATA (..) to print randomly generated even numbers in the file , “LAB.txt”. 3. Function int GET_DATA_in_ARRAY (int x[]) is designed to open the “LAB.txt” file, scan data from it and store them in an array of integers, and return the number of data read from the file. 4. Main calls GET_DATA_in_ARRAY ( ) function to scan data from the file and store them in its own array called, even_array[max_num]. Here max_num is a large global constant integer, e.g. 100. 5. Function float Min_Max(int x[], int num, int *min, int* max) is designed to calculate and return average value of integers in an array of size num. The function can also find smallest and largest numbers in the array and make them available to the main using pointers. 6. Main calls Min_Max(int x[], int num, int *min, int* max) and using the values provided by this function prints the minimum, maximum and average of numbers in the array on computer screen. TYPICAL SCREEN OUTPUT IS SHOWN BELOW ********************* Tell me maximum attempts I get to generate random numbers: 50 Enter minimum and maximum limits-separated by blank: 3 79 Largest even number=76 Smallest even number=6 Average=44.8889 Press any key to continue . . .

Solution

strings are just arrays of characters.

example:*str = \"10201\"

array[0] = 1
array[1] = 0
array[2] = 2
array[3] = 0
array[4] = 1

All my attempts at achieving this just result in an array full of garbage numbers.

follow the below code:

Code:
int *array;
array = malloc(sizeof(int)*(strlen(str));
for(i=0; i<strlen(str); i++) {
array[i] = str[i]
}

use only C progamming (not C++)Function void STORE_EVEN_DATA (int n, int min, int max) opens a file “LAB.txt” and writes in it even random numbers which are wit

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site