IntroductionC语言,实现基本的字符串操作函数和矩阵计算,包括字符串复制,字符串拼接,字符串比对,计算字符串的长度以及统计字符串中字符出现的频率等基本函数。用二维数组表示矩阵,计算矩阵的加法和乘法,涉及使用malloc和free动态分配二维数组的内存,矩阵的计算等知识。RequirementCSCE 155E Fall 2016Homework 5Due Date: 11/13/2015, 2.30 PMInstructions Follow instructions carefully, failure to do so may result in points being de-ducted. Make sure your programs compile and run by using the web grader interface. Youdo not need to printout your source code for the programs. Print a copy of the rubric forthis assignment and hand in a hard copy by the due date.Partner policy: You are not allowed to work with a partner for this assignment.Program 1. String Utilities In this exercise you will implement several utility functionsinvolving strings. You will place all of your function prototypes in a header file namedstring_utils.h and all of your function definitions in a source file, string_utils.c. As before,you should implement your own main test driver program to test your functions, but youneed not hand it in.(a) void addChar(char str, char c, int n)- this function should add a char c at index n in string str. The following charactersshould be shifted up to make room for the inserted character. For example, a call tothis function on the string “Hello World”, ‘p’, ‘4’, would result in the string “HellpoWorld”(b) int numChar(const char src, char c)- this example determines the number of character c appears in the string. It doesnot matter if the letter in the string is capitalized or not. For example, a call to thisfunction on the string “HellO World”, ‘o’, would return 2(c) int isPalindrome(const char src)- this example determines if the string src is a palindrome or not. Return 1 if the stringis a palindrome and 0 if not. For example, a call to this function on the string “testset”,will return 1(d) int strCompare(const char str, const char str2)- Write your own string comparison function that compares two strings for equality.You cannot use the string comparison functions. Make sure the comparefunction is case insensitive. Return 0 if the two strings are equal and 1 if they are not.For example, a call to this function on the string “Hello world”, and “Hello World” willreturn 01(e) char strCat(char str, char str2)- Concatenate the two strings “str” and “str2” and store that in a newly created dynamicstring. The function should return this dynamic string. You cannot use the concatenation functions. For example, a call to this function on the string “Hello”, and“ World” will return a dynamically created string that contains “Hello World”(f) void consonantVowel(char str)- This function will print out the number of consonantes and vowels in the string. Note:printing should be done in the function (notice the return type is void). For example, acall to this function on the string “Hello”, will print Consonants: 3, Vowels 2Program 2. Array In this exercise you will write several functions that operate on arrays.You will place all the function prototypes in a header file named array_utils.h with theirdefinitions in a source file named array_utils.c. You should test your functions by writing adriver program, but you need not hand it in.(a) The dot product of two arrays are a = [a 1 ,a 2 ,a 3 ,..,a n ] and b = [b 1 ,b 2 ,b 3 ,..,b n ] isa · b =nXi=1a i b i = a 1 b 1 + a 2 b 2 + ··· + a n b nWrite a function that computes the dot product of the two arraysint dotProduct(const int a, int size, const int b, int size2);(b) Write a function that takes an integer array and returns the number of integers thatare prime in the arrayint numPrime(const int a, int size);(c) Write the following function:int arrayDifference(const int a, const int b, int sizeOfA, int sizeOfB);which dynamically creates an array and fills it with all integers that can be found ina , but not b . The values in the returned array should be unique; that is, there shouldnot be any duplicates. Furthermore, the size of the allocated arrays should not wastememory.(d) Write the following function:int arrayIntersect(const int a, const int b, int sizeOfA, int sizeOfB);which dynamically creates an array and fills it with all integers that can be found in aand b . The values in the returned array should be unique; that is, there should not beany duplicates. Furthermore, the size of the allocated arrays should not waste memory.Program 3. Matrices In this exercise you will write several functions that operate onmatrices or two-dimensional arrays. For this exercise, we will restrict our attention to squarematrices-collections of numbers with the same number of columns and rows. You will place2all the function prototypes in a header file named matrix.h with their definitions in a sourcefile named matrix.c. You should test your functions by writing a driver program, but youneed not hand it in.(a) Write a function that takes two matrices and determines if the sum of all of theelements in matrix A is equal to the sum of all the elements in matrix B. Return 0 ifthe summation is equal and 1 if they are not equal.int sumEqual(int A, int B, int n);(b) Write a function that takes two matrices and determines if they are equal (all of theirelements are the same). If the matrices are equal, return 0. Return 1 if they are notequal.int isEqual(int A, int B, int n);(c) Write a function to compute the sum of the elements along the diagonal of the matrix.Return the sum of the elements along the diagonal.int diagonal(int A, int n);(d) Write a function to compute the summation of matrix A and B.int sumMatrix(int A, int B, int n);(e) The product of two square n × n matrices:C = A × BThe entries for C are:c ij =nXk=1a ik b kjwhere 1 ≤ i,j ≤ n and c ij is the ( i , j )-th entry of the matrix C . Write the followingfunction to compute the product of two n × n square matrices:int product(int A, int *B, int n);BonusName the files, bonus.c and bonus.hchar highestFreq(char str)- this function should return the highest frequency character c in the string. For example, acall to this function with the string “Hello World”, would return “l”,本团队核心人员组成主要包括BAT一线工程师,精通德英语!我们主要业务范围是代做编程大作业、课程设计等等。我们的方向领域:window编程 数值算法 AI人工智能 金融统计 计量分析 大数据 网络编程 WEB编程 通讯编程 游戏编程多媒体linux 外挂编程 程序API图像处理 嵌入式/单片机 数据库编程 控制台 进程与线程 网络安全 汇编语言 硬件编程 软件设计 工程标准规等。其中代写编程、代写程序、代写留学生程序作业语言或工具包括但不限于以下范围:C/C++/C#代写Java代写IT代写Python代写辅导编程作业Matlab代写Haskell代写Processing代写Linux环境搭建Rust代写Data Structure Assginment 数据结构代写MIPS代写Machine Learning 作业 代写Oracle/SQL/PostgreSQL/Pig 数据库代写/代做/辅导Web开发、网站开发、网站作业ASP.NET网站开发Finance Insurace Statistics统计、回归、迭代Prolog代写Computer Computational method代做因为专业,所以值得信赖。如有需要,请加QQ:99515681 或邮箱:99515681@qq.com 微信:codehelp
网友评论