CSc 21200 Homework 1

$30.00

Category:

Description

5/5 - (4 votes)

1. Write a function that display all numbers between 0 and 30 (inclusive) and
• Print Fizz for multiples of 3
• Print Buzz for multiples of 5
• Print FizzBuzz for multiples of 3 and 5
2. Write a function that lets the user enter a series of ANY integer numbers. If the user enters
99, the program will display the largest and smallest numbers (not including 99) that was
entered, and the program will end. Note: DO NOT store all the numbers. Use the included
function to print
3. Write a function that lets the user enter alphabet letters into a static char array until either the
user enters a non-alphabet letter or it has reached the MAXSIZE. You can use the
isalpha([char]) function in the cctype library to check if the input is an alphabet letter or not.
4. Assuming the user will only enter all lower-case letter, write a function that returns the letter
of the highest number of occurrences in the user input array using Q1. If two or more
characters have the same number of occurrences, return the one closest to a.
5. Write a function that ask the user the number of shift they want and shift the array according.
Note: You CANNOT use any additional arrays. You should write a swap function.
For example, if the input characters are
a b c a d e b c a
and the number of spaces to shift is 3, the output will be:
b c a a b c a d e
If the number of spaces is negative, the shift will be to the left.
6. Write a function that combine a sorted char static array ar1 with size n1 and a sorted char
static array ar2 with size n2 and return one sorted char array of the combine of those two
arrays.
For example:
ar1[n1] = {‘a’, ‘c’, ‘e’, ‘f’}; ar2[n2] = {‘b’, ‘d’, ‘g’};
newAr[n1+n2] = {‘a’, ‘b’, ‘c’, ‘d’, ‘e’, ‘f’, ‘g’};