Entries by admin

A program that asks the user if he or she wants to conver…

A program that asks the user if he or she wants to convert values that are lengths or weights. If the user chooses lengths, the program calls a stub function convert_lengths that simply indicates the user’s choice. If the user chooses weights, the program calls a stub function convert_weights that simply indicates the user’s choice. […]

A program that calculates the area and perimeter of a rec…

A program that calculates the area and perimeter of a rectangle. The area and perimeter are calculated using two separate functions, which both take two arguments of double type for width and length of the rectangle. Calculate the area and perimeter using these two functions in the main program for a rectangle with width and […]

A program that counts the number of times a character seq…

A program that counts the number of times a character sequence occurs in another character sequence. Create a function, ‘pattern’ to do this: int pattern(char *ptr1, char *ptr2) In the main function, declare two character arrays and initialize to the following sequence: ‘1’,’1′,’0′,’1′,’0′,’0′,’1′,’1′,’1′,’0′,’1′,’1′,” ‘1’,’0′,’1′,” Call the ‘pattern’ function and pass the first character array as […]