Question: * PLEASE CREATE THREE FUNCTIONS THAT ARE ASKED IN THE TASK* 1. Write a function, build12Digits(), that will create 12 random digits (0-9) and store
* PLEASE CREATE THREE FUNCTIONS THAT ARE ASKED IN THE TASK*
1. Write a function, build12Digits(), that will create 12 random digits (0-9) and store them into an integer array. Put 0 into the 13th element for the initial check code. The function prototype for build12Digits() is as the following: void build12Digits(int [], int); /* the first parameter is an integer array and second parameter is an integer which is the size of the array) */ 2. Write a function, printEANCode(), that will print the entire EAN codes (13 digits). The function prototype is: void printEANCode(int [], int); /* the first parameter is an integer array and second parameter is an integer which is the size of the array)*/ 3. Write a function, calculateCheckDigit(), which will calculate the correct check digits and set it to the 13th element in the array. The function prototype is: void calculateCheckDigit(int [], int); /* the first parameter is an integer array and second parameter is an integer which is the size of the array)*/ 4. Modify the main() function as the following: Declare an integer array with 13 entries. The size can be define as a constant. Call build12Digits() function [1]
Call printEANCodes() function so that it looks like a normal EAN, but the check digit is 0. (example: 8 691484 26000 0). Please label this output as the incorrect check digit before the calculation. Call calculateCheckDigit() function to calculate and store the correct check digit Call printEANCodes() function so that it looks like a normal EAN, but the check digit is 0. (example: 8 691484 26000 8). Please label this output as the correct check digit after the EAN calculation.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
