Details of this Paper

C 9 questions final !

Description

solution


Question

The Questions;1) Write a macro, MIN5 (A, B, C, D, E), which takes five arguments and returns the smallest value.;2) Write a function which will determine how many words are in a given string. You can assume that one;or more consecutive white spaces is a delimiter between words.;3) Write a function that is passed a month, day, and year and will determine if;that date is valid. You can assume each parameter is passed in as an integer.;Remember to check for leap year!;validDate (5, 31, 1961).... would be valid;validDate (13, 4, 1967)... would be invalid, the month is invalid;6) Write a function that will determine if a given string is a palindrome. DO NOT use the C library function: strrev;A palindrome is a word or sentence that reads the same forward as it does backward.;Examples of words would be civic or rotor... a word or phase would be;Never odd or even;A good web site of examples is: http://www.rinkworks.com/words/palindromes.shtml;7) Write a function that will return in a structure the following characteristics of a given string;1) string length (use strlen);2) number of upper case characters;3) number of lower case characters;4) number of digits;5) number of non-alphanumeric characters.;8) Write a function, myBaseBallStats, that is passed the following integer stats on a baseball player;Number of Singles, Doubles, Triples, and Home Runs as well as Number of At Bats.;Based on this information, return a structure that contains the following;Total Bases, Batting Average, Home Run Ratio, and Slugging Average.;You do not need to be a baseball fan to do this... All the information you need in;terms of the formulas and explanations can be found at;http://www.baseball-almanac.com/stats.shtml;Note: Number of hits is: singles + doubles + triples + home runs;9) Most people enjoy watching movies these days, whether its the classics or modern ones.;Develop a set of structures that could be used to model the information about a movie collection.;What type of information would you want to collect and store about a movie? What would be the right;types in C for that information? Define supporting structures as needed and have one final structure type that;is made up of various members (some members may be on some structure type, others may be simple integers;floats, chars, arrays, etc). No program is needed although you might want to create a simple main function;and include your structure types just to test that everything compiles.;This question is similar to the final question on the midterm, but now you have learned about many different;types since then. Here is a template to use to get started and indicates what I am looking for in your answer.;Use everything you learned this semester, especially the last set of lectures notes from Chapters 13 - 17.;/* add supporting structures - expect many structure types here... date is good example */;struct date;int month;int day;int year;/* add other supporting structures */;/* Final structure, such as struct movie */;struct movie;/* some members may be a structure type themselves, here is an example */;struct date releaseDate, /* the date the movie was released */;/* other members may be ints, floats, doubles, chars, enum,... */;char title [100], /* the title of the move */;/* add others */;int main ();struct movie myMovie [1000];/* nothing else needs to be added to main */;return (0)

 

Paper#69367 | Written in 18-Jul-2015

Price : $32
SiteLock