A function prototype looks similar to the function ___, except there is a semicolon at the end.
Arguments
Body
Call
Header
Int's are not the only data type that can be passed to a function. All valid data types, such as double, char, bool, string, etc. can be passed.
Ask the user to enter their first name and last name in main(). Pass those values to a function and produce the last two lines of output shown below:
Output:
Enter your first name: [user types: Mary Jo]
Enter your last name: [user types: De Arazoza]
Your full name is: Mary Jo De Arazoza
Your name can also be written as: De Arazoza, Mary Jo
What is the danger of earmarks? What are their benefits?
Based of the article: "Should Congressional Earmarks Be Allowed?"
This is a twist on the previous exercise that will help you review loops and decision structures. You will again ask the user to enter two numbers. However, you will ALWAYS subtract the smaller number from the larger number to ensure that you never get a negative number for an answer. You do this by checking the numbers and switching them if they are not in the right order (larger then smaller). All of this checking, switching, subtracting, and output of the answer should occur in a function.
Finally, ask the user if they would like to run the program again. By now, you should know exactly what type of loop to use.
Output:
Enter two integers (separated by a space) and this program will subtract the smaller from the larger: [user enters: 7 5]
7 - 5 = 2
Do you want to run this program again? [user enters: y]
Enter two integers (separated by a space) and this program will subtract the smaller from the larger: [user enters: 5 7]
7 - 5 = 2
Do you want to run this program again? [user enters: n]
This is another easy exercise to test your knowledge of the fundamentals. In main(), ask the user to enter two integers. Pass those two integers to a function that will subtract one number from another. This function must also output the answer to the user.
Output:
Enter two integers (separated by a space) and this program will subtract them: [user enters: 5 7]
5 - 7 = -2
Create two functions (with appropriate names) that produce the output below. Both functions must use a prototype. All that should be present in main() is the call to these two functions and a blank line of output between the function calls.
This is a very easy exercise. Focus on the fundamentals. Make sure you review my solution file to make sure your syntax and name choice is good.
Output:
This is the first part of my program.
It was created with a function. <-- These two lines are output by the first function
This is the second part of my program.
It was created with a different function. <-- These two lines are output by the second function
How many ways can 3 cars and 4 trucks be selected from 8 cars and 11 trucks to be tested for a safety inspection?
12 jobseekers applied for 3 available vacant positions in a company. In how many ways can the job be offered among these applicants if a particular applicant must be employed?
In how many ways can a family of six be seated on a bench if the parents must sit at both ends?
There are 7 boys and 5 girls in a youngsters’ club. A committee of 3 boys and 2 girls is to be chosen. How many different possibilities are there?