C programing Q1: Write a function called roundNum that rounds a floating point n
ID: 3716329 • Letter: C
Question
C programing
Q1: Write a function called roundNum that rounds a floating point number to the nearest integer. For example for the following inputs, we should get the corresponding output: 5.3 à 5 6.7 à 7
Q2: Write a function called validDate that takes an input string from the user. The string should be in the following format mm-dd-yyyy. Check that the string passed into the function has a length of 10 and uses hyphens ‘-‘ in the appropriate locations. If the string is formatted incorrectly, return false. If the string is formatted correctly, return true. For example for the following inputs, we should get the corresponding output: 05-28-90 à false 5-28-90 à false 05-28-1990 à true
Q3: Write a function that swaps the first and last elements in an integer array
Q4: Write a function that finds the largest elements in an integer array
Q5: Write a function that inserts a value into an arbitrary position of an array
Q6: Create an array of structures called class. Each element in the array should represent a student. A student structure should contain the following information: first name, last name, GPA and age. Use appropriate data types within the struct for each field.
Q7: Write a function called parseDate. As input, the function should take in a string stored in the following format: mm-dd-yyyy. The function should return a struct that separates the month, day and year.
Explanation / Answer
1a)
2a)
3a)
4a)
5a)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.