Find the error(s) in each of the following program segments and explain how the error(s) can be corrected: (i) int function1() { cout << "Inside function function1 " <<
endl; int function2() { cout << "Inside function function1 " << endl; } }
Write function headers for the functions described below:
(iv) The function countChar returns the number of occurrences of a character in a string, both provided as parameters
Write function headers for the functions described below:
(iii) The function time inputs seconds, minutes and hours and returns them as parameters to its calling function.
Write function headers for the functions described below: (ii) The function mult has two floating point numbers as parameters and returns the result of multiplying them.
Write function headers for the functions described below: (i) The function check has two parameters. The first parameter should be an integer number and the second parameter a floating point number. The function returns no value
You are given with a list of positive integers nums, return whether there exist integers a, b, and c such that a ** 2 + b ** 2 = c ** 2.
by CodeChum Admin
It's time to find out if something is true or false. Let's test your capabilities by creating a program that checks if two integers are equal!
Instructions:
Input
1. First integer
2. Second integer
Output
The first two lines will contain message prompts to input the two integers.
The next line will contain the inputted integers.
The last line will contain a string which is the result, if the condition were true.
Write a user defined function that will ask the user to input 5
array integers and performed the following menu functions:
1. Maximum
2. Minimum
3. Count Odd
4. Count Even
5. Exit
If the user press the following number (s), do the corresponding
functions
1. Print the largest array value
2. Print the lowest array value
3. Count the number of even number(s)
4. Count the number of odd number(s)
5. Exit
Sample Input/Output:
==========Main Menu==========
[1] – Maximum
[2] – Minimum
[3] – CountEven
[4] – CountOdd
[5] – Exit
==============================
Enter your choice: 2
Enter 5 integer number(s):
20
30
8
500
800
The lowest value is: 8
Write a C++ program to call user defined function through switch
statement.
Sample Input/Output:
==========Main Menu==========
[S/s] – Square
[C/c] – Cube
[D/d] – Double
=============================
Enter your choice:d
Enter an Integer number:5
Double of 5 is 10
Do you want to try again? Y/y
==========Main Menu==========
[S/s] – Square
[C/c] – Cube
[D/d] – Double
=============================
Enter your Choice:s
Enter an Integer number:10
Square of 10 is 100
Do you want to try again? Y/y
==========Main Menu==========
[S/s] – Square
[C/c] – Cube
[D/d] – Double
=============================
Enter your Choice:C
Enter an Integer number:4
Cube of 4 is 64
Do you want to try again? N/n
Exit/Terminated
Minimum and Maximum array entry
With a function that take as parameters a one dimensional array and
the capacity of the array. Your function has to find the minimum and
maximum entry in a one dimensional array. Write a driver program that
reads array values and finds the minimum and maximum entry using your
function.
Sample Input/Output:
Enter a no. of array elements: 5
Array[1]: 20
Array[2]: 80
Array[3]: 90
Array[4]: -23
Array[5]: 70
Minimum Array Entry: -23
Maximum Array Entry: 90