Question: Skeleton code is below. Instruction: You will be provided with a skeleton code for Lab 6, which you can find in the folder for Lab
Skeleton code is below.
Instruction: You will be provided with a skeleton code for Lab 6, which you can find in the folder for Lab Slides, for Lab6. You have to download the file and copy paste the code in Visual Studio. Brief Description of the Program: The program has two arrays: one of type int and the other of type char. They are declared in the skeleton code for you. The program has 7 functions including int main(). The program takes input from the user, the values of the two arrays and prints them on the screen. Then it finds the highest element in each array and prints the element and its location in the array on the screen. Finally, it sorts the arrays and prints the sorted arrays on the screen. The skeleton will be discussed in the lab to ensure you understand it line by line and it has comments given at appropriate places. You have to read the comments and write your code as described by the comments.
#include
#include
#pragma warning(disable:4996)//The macro SIZE is to specify the size of the arrays#define SIZE 5 //-----------FUNCTIONPROTOTYPES-------------------------------------------------------------------------------// The first three functions are for the int arrayvoid print_IntArray();void Rank_IntArray();void Sort_IntArray(); //The following three functions are for char arrayvoid print_CharArray();void Rank_CharArray();void Sort_CharArray(); //----------GLOBAL VARIABLES--------------------------------------------------------------------------------------//Declaration of the two arrays//First is an integer array and the second is an array of char'sint ArrayOfIntegers[SIZE];char ArrayOfCharacters[SIZE]; //---------------Themain()---------------------------------------------------------------------------------------int main(void){
int i; //Asking the user to enter values for first array(int array)printf(" Let's populate the first array");printf(" Enter 5 values for the array of integers: (Only enter whole
numbers)");
for (i = 0; i < SIZE; i++){
printf(" Enter %d element: ", i+1);scanf("%d", &ArrayOfIntegers[i]);getchar();
}//Write the code Asking the user to enter values for the second array
which is of type char
//Place Function calls to print functions to first print the int array and
then the char array
//Place Function calls to find the highest element in each of the arrays,
first in the int array and then in the char array
//Place Function calls to sort the arrays, first the int array and then
the char array
} /* FUNCTION DEFINITION FOR THE PRINT FUNCTION FOR THE INT ARRAYThis function will print the array that was entered by the user in int main()*/void print_IntArray(){ } /* FUNCTION DEFINITION FOR THE PRINT FUNCTION FOR THE CHAR ARRAYThis function will print the char array that was entered by the user in intmain()This function is already complete*/void print_CharArray(){
int i;printf(" Displaying the contents of the second array of type char");for (i = 0; i < SIZE; i++){printf(" %d element is: %c", i, ArrayOfCharacters[i]);}getchar();
} /*FUNCTIONS TO FIND THE HIGHEST ELEMENT IN THE INT ARRAY*/void Rank_IntArray(){
//Code for ranking the largest number
} /*FUNCTIONS TO FIND THE HIGHEST ELEMENT IN THE CHAR ARRAY*/void Rank_CharArray(){
// Code for ranking the last alphabet, For example: Among A, D, G, X : X
is the last alphabet. } /* FUNCTIONS TO SORT THE INT ARRAY IN INCREASING ORDERThis function will first sort the array elements and thencall the function print_IntArray() to print the sorted array*/void Sort_IntArray(){
// Code for Sorting printf(" After Sorting");print_IntArray();
} /* FUNCTIONS TO SORT THE CHAR ARRAY IN INCREASING ORDERThis function will first sort the array elements and thencall the function print_CharArray() to print the sorted array*/void Sort_CharArray(){
// Code for Sorting
printf(" After Sorting");print_CharArray();
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
