Details
This set of problems and coding challenges are to be done in lab and at home.
All the cpp files from this assignment should be in a folder.
The name of the folder should follow this format:
lastName_firstName_#4
For example, my name is Alex Chen, folder name will be "Chen_Alex_#4"
Failure to follow this naming convention will result in your assignment not being graded.
The folder is to be zipped and submitted on blackboard on the due date.
#1
Redo #8 from Assignment#3. This time the main function should call an auxiliary function that does everything. Rename the file function1.cpp **HINT** since the program purpose is to print out something, the function should be void.
#2
Redo #9 from Assignment#3. This time the main function should only prompt the user for the height and width. Call an auxiliary function that does everything else. Rename the file function2.cpp.
#3
Redo #10 from Assignment#3. This time the main function should only prompt the user for a size. Call an auxiliary function that does everything else. Rename the file function3.cpp.
#4
Write a triangle.cpp that does the following:
- In the main function, ask the user for the length of the 2 sides of a right triangle.
- Pass in the 2 sides into a function and the function returns the length of the hypotenuse.
- Print out the length of the two sides and the hypotenuse
#5
Write a number.cpp that does the following:
- Part I:
- In the main function, ask the user to enter 5 integers. Pass the integers into a function and the function returns the largest number.
- Store the largest number.
- Part II:
- Pass the largest number into a function and the function finds and prints all the factors of that number.
#6
Write a prime.cpp that does the follwing:
- In the main function, ask the user to enter a number between 2-1000.
- Check if the input is valid, if it is invalid, terminate the program.
- Pass the number into a function that finds and prints all the prime numbers up to that number.
For example, the user enters 100 the program prints:
2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97
**HINT** use two functions.