#### Details of this Paper

##### Write a function called

Description

solution

Question

Write a function called convert_weight. This function should convert between pounds and kilograms, and vice versa. Here is the prototype for this function;void convert_weight(int, char[], int*, char[]);There are 2.2 pounds per kilogram.;The second and forth parameters are strings, which specify the units ("lbs" or "kgs"). An example call to this function is;#include;int main();char newline, another = 'y;int weight1, weight2;char units1[4], units2[4], // length 4 because of '\0';while (another == 'y');printf("Enter a weight and the units of the weight (lbs or kgs)\n");scanf("%d %s", &weight1, units1);convert_weight(weight1, units1, &weight2, units2);printf("%d %s = %d %s\nAnother (y or n)\n", weight1, units1, weight2, units2);scanf("%c%c", &newline, &&another);return 0;Write a function called strcat373, which concatenates two strings in precisely the same way that strcat does from the C library. The concatened string is constructed in the array string1, a pointer to the beginning of this array is also returned. string2 should not be affected by this function. Please use "array syntax" in strcat373, that is, the parameters as well as the local variables should not use the explicit pointer declaration (using the * symbol), with the exception of the value that is returned by this function. Instead, you should used the [ ] operator. You may not use any of the built-in C string library functions to complete this code.;Here is the prototype of this function;char *strcat373(char string1[ ], char string2[ ]);And here is a main function which calls strcat373.;int main();char str1[81], str2[81];char again = 'y', newline;while (again == 'y');printf("Enter a string\n");scanf("%s", str1);printf("Enter another string\n");scanf("%s", str2);printf("The concatention is %s\n", strcat373(str1, str2));printf("Second test: The concatenation is %s\n", str1);printf("The second string is still %s\n", str2);printf("Again? (y/n)\n");scanf("%c%c", &newline, &&again);Write a function called strcmp373, which compares two strings in precisely the same way that strcmp does in the C library. Please be sure that you emulate the strcmp C function. Note that strcmp returns 0 if the two strings are equal, even though 0 normally means false in C. This time, please use "pointer syntax" in writing this function. That is, the [ ] operator should not be used at all when referring to particular characters in string1 and string2, instead, all parameters and local variables should be declared as pointers (using the * symbol). You may not use any of the built-in C string library functions to complete this code.;Here is the prototype of this function;int strcmp373(char *string1, char *string2);And here is a main function which you can use to test strcmp373.;int main();char str1[81], str2[81];char again = 'y', newline;while (again == 'y');printf("Enter a string\n");scanf("%s", str1);printf("Enter another string\n");scanf("%s", str2);int comp = strcmp373(str1, str2);if (comp 0);printf("%s is alphabetically after %s\n", str1, str2);else printf("%s and %s are the same\n", str1, str2);printf("Again? (y/n)\n");scanf("%c%c", &newline, &&again)

Paper#69030 | Written in 18-Jul-2015

Price : \$27