Sie sind auf Seite 1von 1

Tutorial 3 Functions and Header Files

Self Review Questions 1. What are header files? Explain its purpose. 2. What are include guards? What are they used for? 3. What are functions? 4. What are reference variables in C++? How they are used in call by reference? 5. Differentiate between a. Call by Value and Call by refrence b. Normal function and Inline Functions c. Inline Functions and Macros

Programming Questions 1. An integer number is said to be a perfect number if the sum of its factors, including 1 (but not the number itself), is equal to the number. For example, 6 is a perfect number, because 6 = 1 + 2 + 3. Write a function to print all the perfect numbers between 1 and 100. 2. Write a function to calculate area and perimeter of rectangle using call by reference and print the area and perimeter in main() function. 3. To swap two numbers using call by value and call by reference using functions.

Das könnte Ihnen auch gefallen