C Answers

Questions answered by Experts: 1 680

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

write a program that receives date and displays it displays it as following depending on user choice:date/month/year or dd/mm/yy
Write a function called arraySum() that takes two arguments: an integer array and the number of elements in the array. Have the function return as its result the sum of the elements in the array.
John was given a task to make a rectangular box during his innovation competition. He was given with
the A cm of wire and B cm2 of special paper. He had to use all the wire (for the 12 edges) and paper (for the 6 sides) to make the box. So what will be the maximum volume of that box?
What is the top element in the stack S.
Stack(S); //create a stack S
Queue(Q); //create a queue Q
Push (S,1); Push(S,2);
Push (S,3); Push(S,4);
Enqueue(Q,5); Enqueue(Q,6);
For (i=1) to 4) {
X=Pop (S);
Enqueue(Q,x);
}
For (i=1 to 6) {
Z=Dequeue (Q);
Push(S,x);
}
In the main function, input one string and pass it to a function named cleanString. This function removes the non-alphabetic characters and writes the rest into a new character array (i.e. non-alphabetic characters are +, - ?, *, 1,2,3,…). After receiving a cleaned array, you should call another function named reverseWords. This function takes and returns the string as a parameter. String should be arranged in a reversed order for each word. All operations in this function should take place on the same string, you shouldn’t be using a temporary array for the reverse operation. Finally, print the result in the main function.

Sample run:

Enter first string: This-?=*is__12the**23%third?[]homework--_?().

Cleaned string: This is the third homework

Reversed string: sihT si eht driht krowemoh
The program must take the reverse of each of the words inside the string and outputs the resultant string without using any string library function except strlen(), gets(), puts(). In the main function, input one string and pass it to a function named cleanString. This function removes the non-alphabetic characters and writes the rest into a new character array (i.e. non-alphabetic characters are +, - ?, *, 1,2,3,…). After receiving a cleaned array, you should call another function named reverseWords. This function takes and returns the string as a parameter. String should be arranged in a reversed order for each word. All operations in this function should take place on the same string, you shouldn’t be using a temporary array for the reverse operation. Finally, print the result in the main function.
Sample run:
Enter first string: This-?=*is__12the**23%third?[]homework--_?().
Cleaned string: This is the third homework
Reversed string: sihT si eht driht krowemoh
Write a C program that reads 10 integers (between 0-1000) into a one-dimensional array
and computes and finds the value that has the largest chain. You should compute the
largest chain as explained below.
Example:
For each value (n) in your array, your chain will be determined as follows;
If n is even -> n=n/2
If n is odd -> n=3n+1
For example , if 12 is your starting number , the chain will be ,
6 -> 3 -> 10 -> 5 ->16 -> 8 -> 4 -> 2 -> 1
12 is even so 12/2 will be 6.
6 is even 6/3 will be 3.
3 is odd 3*3+1 will be 10.
.
.
.
The chain will grow until the value is 1.
Write a function called findLargestChain() that accepts an integer, finds and prints the
chain elements to the screen , and returns the number of elements.
You should store the number of elements into another array.
In the main program, you should read 10 integers into an array , call the function for each
integer and store the number of elements into another array.
how to change the code so that it can sort

struct SResult sample[] = { {"A1234", 10}, {"A1239", 5}, {"A1394", 7}, {"A1434", 3}, {"A1454", 5}, {"A2884", 7}, {"A3235", 7}, {"A4334", 9}, {"A4884", 2}, {"A6934", 5}, {"A7265", 7}, {"A9559", 3} };

void counting_sort(struct SResult scoreArr[], int N, int final[]) {

int freq[11] = {0}, cfreq[11] = {0};
int i, curScore;

//1. Compute Frquency
for (i = 0; i < N; i++){
freq[ scoreArr[i].score ] ++;
}

//2. Compute Cumulative Frequency
cfreq[0] = freq[0];
for (i = 1; i < 11; i++){
cfreq[i] = cfreq[i-1] + freq[i];
}

//3. Produce Final Position
for (i = 0; i < N; i++){
curScore = scoreArr[i].score;
final[ cfreq[ curScore ] - 1 ] = curScore;
cfreq[curScore]--;
}
}
A point represents a coordinate in an x-y plane. It is supported by the following functions:

Point * make_point(double x, double y)
double x_of(Point *p)
double y_of(Point *p)
void print_point(Point *p)

Write a function Point * mid_point that accepts two points as arguments and returns a point that is the mid-point of these two input coordinates.
#include<stdio.h>
int main()
{
int n;
for(n = 7; n!=0; n--)
printf("n = %d", n--);
getchar();
return 0;
}

anyone tell the o/p ??
LATEST TUTORIALS
APPROVED BY CLIENTS