Questions: 1 978

Answers by our Experts: 1 850

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

From a set of array elements, find the number of occurrences of each element present in the given array.


C programming , Let A and B be the two matrix. The size of matrix A is m and size of matrix B. Then, find subtraction of C, is a A and B is defined as C(ij) = A(ij) - B(ij).


The Air Force has asked you to write a program to label aircrafts as military or civilian. Your program input is the plane's speed and its estimated length. For planes traveling faster than 1100 km/hr, you will label those shorter than 52 m “military", and longer as “Civilian". For planes traveling less than 1100, you will issue an “aircraft unknown" statement.


Your task is to declare a 2D array whose dimensions should be entered by the user of the program.

• Then you should initialize the array with ones (using nested loops).

• Next you have to write a function array_multiply() which takes in the array or its pointer as argument and multiplies all its entries with a user input number. (Hint: you will also need to pass in the dimensions of the matrix to this function).

• Similarly write a function array_add() that adds a constant number to all the entries in a 2D array.

• Print the results of calling these functions. 


Exercise 2 : Mining Temperature Data

The highs and lows of the 3 first weeks of 2020 temperature data are available on a piece paper and we have decided to store

them in a three-dimensional array in which the first index represents the 3 first weeks of the year, and take the value from 0 to

2; the second index is numbered 0 through 6 and represents the days of the week, and the last index which is numbered 0 and

1, represents the day’s high and low temperatures, respectively.

(2.1) Write a C program that enables you to capture the 3 first weeks of 2020 temperature data, from the keyboard, and store

them in the array described above. You must check the validity of any data entered.

(2.2) Write functions to request the following:

(a) Any day’s high and low temperature

(b) Average high and low temperature for given week

(c) Week and day with the highest temperature

(d) Week and day with the lowest temperature

(2.3) Write a driver program to test your functions defined in (2.1) and (2.2).


Your second task is to implement the Insertion Sort algorithm by making a function with the following prototype; void insertion_sort(int * ptr_array, int size, int order); This function takes as input a pointer to the start of the array, and the array size and sorts it inplace. The last input to the function is the sorting order (0 for ascending and 1 for descending).


Write a C function remove_blanks()that replaces two or more consecutive blanks in the input string by a single blank. For example, if the input is:


        “Grim     return   to      the       planet           of         apes!!”


Then output should be:


“Grim return to the planet of apes!!”


The function should return the number of blank spaces removed. Remember that string is a null-terminated character array! The function prototype is given below:


int remove_blanks(char input_string[],char output_string[]);


Write a C function remove_blanks()that replaces two or more consecutive blanks in the input string by a single blank. For example, if the input is:


“Grim return to the planet of apes!!”


Then output should be:


“Grim return to the planet of apes!!”


The function should return the number of blank spaces removed. Remember that string is a null-terminated character array! The function prototype is given below:


int remove_blanks(char input_string[],char output_string[]);


Write a function power(a, b), to calculate the value of a raised to b, using: (a) non-recursive method (b) recursion 


Write a program to take the values of two integers and use pointers to add 10 to the value of each integer. 


LATEST TUTORIALS
APPROVED BY CLIENTS