6)
int max(int a[], int n){
int m = a[0];
for(int i = 0;i<n;i++){
if(m < a[i]){
m = a[i];
}
}
return m;
}
7)
void reverse(char x[], int n){
int i = 0, j = n-1;
char ch;
while(i<j){
ch = x[i];
x[i] = x[j];
x[j] = ch;
i++;
j--;
}
}
help me solving this both please in c++ language 6 Write function max(int al Lint n)...
write a C program!! Q2 and Q3
Write the following functioned int search(int a[], int n, int key, int **loc); a is an array to be searched, n is the number of elements in the array, key is the search key, and loc is a pointer to the first location of the search key in array a (if found) or NULL otherwise. The function returns 1 if key is found in a, and returns 0 otherwise. Write a main() and...
C++ language
Write a function, int flip(string a[], int n); It reverses the order of the elements of the array and returns n. The variable n will be greater than or equal to zero. Example: string array[6] = { "a", "b", "", "c", "d", "e" }; int q = flip(array, 4); // returns 4 // array now contains: "C" "" "" "a" "d" "e" O Full Screen 1 code.cpp + New #include <string> 2 using namespace std; 3 4- int...
Programming language C Please go through this carefully. Needs function void add(int *a1, int n, int *a2) Write a program addition.c that reads in an array (a1) of numbers, and creates a new array (a2) of numbers such that the first and last numbers of a1 are added and stored as the first number, the second and second-to-last numbers are added and stored as the second number, and so on. You need to check for even and odd length of...
Write in C language
5. [8] Write a function with prototype » void string_copy(const char source[], char destination[], int n); This function copies string source to string destination. Parameter n represents the size of array destination. If the latter array is not sufficiently large to hold the whole source string then only the prefix of the string which has room in the latter array should be copied. Note that after copying, the null character should also be included to mark...
C++ ONLY Write a function, int flip(string a[], int n); It
reverses the order of the elements of the array and returns n. The
variable n will be greater than or equal to zero.
Example:
string array[6] = { "a", "b", "", "c", "d", "e" };
int q = flip(array, 4); // returns 4
// array now contains: "c" "" "b" "a" "d" "e"
Write a function, int flip(string a[], int n); It reverses the order of the elements of...
C Language : int getRandomNumber( int min, int max ) Write a function that computes a random number between min and max, inclusive, and returns it.
if it is possible help me with
the code in C language and I could learn it, thanks !
Write a function that computes the integer mean of an array of integers. For example, the integer mean of -1, 4, 2 is (-1 + 4 + 2)/3 = 5/3 = 1, where/des integer division. The function should implement the following specification:/* Computes the integer mean of an array and stores it * where mn references. Returns -1 for erroneous input...
please implement this function by C language
Write a string compare function which returns 1 if the strings match for n characters starting at offset m, O if the strings don't match. You must check if m is within the length of both s and t. int submatch(char* s, char* t, int n, int m)
Write a string compare function which returns 1 if the strings match for n characters starting at offset m, O if the strings don't match....
Done in C++ using visual studio 1. Write a program with one additional function called int[] reverseArray(int array). This function will receive an array from main and then reverse and should return the reversed array to the main to print out. Use a single array and a single loop, you’re are neither allowed to print out just in reverse order nor allowed to use another array variable to store the original array in reverse order. 2. Write a program which...
In C++ Write a function int * return_matches(int a[], int & size,TEST t) which returns an array (allocated off of the heap in the function) containing only the elements of array a that pass the “test” t. The function iterates through all the elements of a, and constructs a new array containing all the elements that pass the test. When the parameter corresponding to “size” is passed in (by reference), it contains the size of the array a. In the...