C++ User Defined Functions

Back To C++ Index


1. program to display hello world on the output screen - Code
2. program to create a function that checks whether a number is even or odd (number is passed to function as argument)- Code
3. program to create a function to find whether a number is even or odd example 2 (number is passed to function as argument)- Code
4. program to create a function to find factorial of number passed to function as argument- Code
5. program to find create a function to check whether a number passed to it as argument is prime or not- Code
6. program to create a function that prints the table of the number passed to it as argument- Code
7. program to create a function that takes two integer arguments and calculates their sum - Code
8. program to create a function that takes two integer arguments calculates difference between them - Code
9. program to create a function that takes two integer arguments calculates their product - Code
10. program to create a function that takes three integer arguments and calculates their sum - Code
11. program to create a function that takes two integer arguments and finds largest of them - Code
12. program to create a function that takes three integer arguments and finds largest of them - Code
13. program to create a function that takes three integer arguments and finds smallest of them - Code
14. program to create two functions to calculate area and perimeter of rectangle (length and breadth of rectangle are passed to functions as arguments) - Code
15. program to create two functions that finds area and circumference of circle (radius of circle is passed to functions as argument) - Code
16. program to create two functions to find area and perimeter of square (side of square is passed to functions as argument) - Code
17. program to create a function that finds volume of a box (width, depth and height of box are passed to function as arguments) - Code
18. program to create a function that check whether character passed to it as argument is vowel or not using switch case statement - Code
19. program to create a function that checks whether character passed to it as argument is vowel or not using if else statement - Code
20. program to create a function that calculates sum of numbers between two numbers a and b (a nd b are passed to function as integer arguments ) - Code
21. program to create two functions that prints the three numbers in ascending order and descending order passed to functions as arguments - Code
22. program to create two functions that prints sum of even numbers and odd numbers between two numbers a and b (a nd b are passed to functions as integer arguments ) - Code
23. program to create two functions to calculate area and perimeter of square based on user choice - Code
24. program to create a function to calculate simple interest based on principal amount,rate of interest and time (principal,rate and time are passed to functions as arguments, principal and rate are passed as float arguments , time is passed as integer argument ) - Code
25. program to create two functions to calculate area and circumference of circle and call them based on user choice using switch statement - Code
26. program to create two functions to calculate area and perimeter of rectangle and call them based on user choice using switch statement - Code
27. program to create a function that computes discount based on price entered by the user (price is passed to function as integer argument , if price is greater than or equal to 1000, discount is calculated as 10 percent else 5 percent ) - Code
28. program to create a function that inputs price and rate of discount from the user and calculates discount amount - Code
29. program to create a function that display hello world for a specified number of times - Code
30. program to create a function that returns factorial of a number passed to it as argument - Code
31. program to create a function that returns 1 if number passed to it is prime and returns 0 if number passed to it is not prime - Code
32. program to create a function that returns area of circle based on radius passed to function as argument - Code
33. program to create a function that returns sum of numbers between a and b passed to function as integer arguments - Code
34. program to create a function that returns largest of three numbers passed to function as integer arguments - Code
35. program to create a function that returns smallest of three numbers passed to function as integer arguments - Code
36. program to create a function that returns volume of box based on width,depth and height passed to function as integer arguments - Code
37. program to create a function that finds yearly salary based on monthly salary - Code
38. program to pass integer arguments to function using call by value method - Code
39. program to pass integer arguments to function using call by reference method - Code
40. program to create six functions and call them based on user's choice using switch statement - Code
41. program to create a function that calculates compound interest based on principal amount, rate of interest and time passed to the function as arguments - Code
42. program to create a function that accepts default arguments - Code
43. program to create a function that returns a reference - Code