Lab 2 - Function and Array
Lab 2 - Function and Array
1. Write a C++ program to add two integers. Make a function add() to add integers and
display sum in main() function. This function will not return any result back to the
main() function.
2. Write a C++ program to add two integers. Make a function add() to add integers and
display sum in main() function. This function will return the result back to the
main() function.
1. Write a C++ program to print all even numbers between two numbers (entered by the
user) by making a user-defined function. Display the answer in main() function.
[Estimate Finish Time: 15 minutes]
2. A program is required to prompt for and accept a time and compute the number of
seconds elapsed since midnight. The time should be entered in the format
HH:MM:SS.
Output sample:
Output sample:
2. Write a C++ program to store and calculate the sum of 5 numbers entered by the user
using arrays.
Output sample:
Output sample:
2. Write a C++ program to store and sort 8 digit numbers that entered by the user. You
should use the arrays to store the digits. (No function is needed in this question.)
[Estimate Finish Time: 15 minutes]
Output sample:
Part C: Homework.
Submit your answer (in doc / pdf) to the Microsoft Teams. Your answer should include your
code and your program screenshot. Submission due date: 16 October 2019.
2. By using the concepts of function and array, develop an interactive program that
able to analyze a set of random numbers by drawing a graph as below.