C++ for Engineers and Scientists
4th Edition
ISBN: 9781133187844
Author: Bronson, Gary J.
Publisher: Course Technology Ptr
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 6.2, Problem 2E
(Practice) For the following function headers, determine the number, type, and order (sequence) of values that should be passed to the function when it’s called and the data type of the value the function returns:
a. int factorial(int n)
b. double volts(int res, double induct, double cap)
c. double power(int type, double induct, double cap)
d. char flag(char type, float current, float time)
e. int total(float amount, float rate)
f. float roi(int a, int b, char c, char d, float e, float f)
g. void getVal(int item, int iter, char decflag, char delim)
Expert Solution & Answer
Trending nowThis is a popular solution!
Students have asked these similar questions
(Use Python)
The function course_average should calculate and return the average of the three values pass to it.
The function main should ask the user to enter three grades and then pass these values to the course_average function. This function should also display a message to the user in the format below.
For example, if the user entered 100, 90 and 95 the message would be:The average of 100 , 90 and 95 is 95
(C++ Programming language)
There are following two major issues associated with cpp programs:• When a program is terminated, the entire data is lost. • If you have to enter a large number of data, it will take a lot of time to enter them all in the different programs.Suggest a solution and elaborate the same with the help of suitable examples.
(C PROGRAMMING ONLY)
DO NOT EDIT THE MAIN FUNCTION
4. Simplicity is Beautyby CodeChum Admin
In life, simplicity is beauty.
Let's try creating something so simple. Let's create a function that accepts the address of an integer and prints n number of asterisks out of it.
For example, if the value of the address passed is 5, then the output would be five asterisks in one line.
Instructions:
In the code editor, you are provided with a main() function that asks the user for an integer and passes the address of this integer to a function call of the simple() function.This simple() function hasn't been implemented yet so your task is just that, to implement it. This has the following description:Return type - voidName - simpleParameter - address of an integerDescription - prints a line of asterisksDO NOT EDIT THE MAIN FUNCTIONInput
1. An integer
Output
Enter n: 5*****
Chapter 6 Solutions
C++ for Engineers and Scientists
Ch. 6.1 - (Practice) For the following function headers,...Ch. 6.1 - Prob. 2ECh. 6.1 - Prob. 3ECh. 6.1 - (Statics) A beam’s second moment of inertia, also...Ch. 6.1 - (Statics) An annulus is a cylindrical rod with a...Ch. 6.1 - Prob. 6ECh. 6.1 - (Physics) Buoyancy is the upward force a liquid...Ch. 6.1 - (Numerical) a. Write a C++ program that accepts an...Ch. 6.1 - (Practice) a. Write a function that produces a...Ch. 6.1 - Prob. 10E
Ch. 6.1 - Prob. 11ECh. 6.1 - Prob. 12ECh. 6.1 - Prob. 13ECh. 6.1 - Prob. 14ECh. 6.1 - Prob. 15ECh. 6.2 - Prob. 1ECh. 6.2 - (Practice) For the following function headers,...Ch. 6.2 - (General math) a. Write a function named...Ch. 6.2 - (General math) a. The volume, V, of a cylinder is...Ch. 6.2 - Prob. 6ECh. 6.2 - Prob. 10ECh. 6.2 - (Numerical) a. The following is an extremely...Ch. 6.2 - Prob. 12ECh. 6.2 - Prob. 13ECh. 6.3 - Prob. 2ECh. 6.3 - Prob. 4ECh. 6.3 - Prob. 5ECh. 6.4 - (Practice) The volume, v, and side surface area,...Ch. 6.4 - (Practice) Write a C++ program that accepts the...Ch. 6.4 - (Simulation) Write a program to simulate the roll...Ch. 6.4 - (Numerical) Write a program that tests the...Ch. 6 - Prob. 1PPCh. 6 - Prob. 2PPCh. 6 - Prob. 6PPCh. 6 - (Numerical) Heron’s formula for the area, A, of a...Ch. 6 - Prob. 10PP
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- (C PROGRAMMING ONLY) 3. From Person to Peopleby CodeChum Admin Now that we have created a Person, it's time to create more Person and this tech universe shall be filled with people! Instructions: In the code editor, you are provided with the definition of a struct Person. This struct needs an integer value for its age and character value for its gender. Furthermore, you are provided with a displayPerson() function which accepts a struct Person as its parameter. In the main() function, there's a pre-created array of 5 Persons.Your task is to ask the user for the values of the age and gender of these Persons.Then, once you've set their ages and genders, call the displayPerson() function and pass them one by one.Input 1. A series of ages and genders of the 5 Persons Output Person #1Enter Person's age: 24Enter Person's gender: M Person #2Enter Person's·age: 21Enter Person's gender: F Person #3Enter Person's age: 22Enter Person's gender: F Person #4Enter Person's age: 60Enter…arrow_forward(Wattan Corporation) is an Internet service provider that charges customers a flat rate of $7.99 for up to 10 hours of connection time. Additional hours or partial hours are charged at $1.99 each. Write a function charges that computes the total charge for a customer based on the number of hours of connection time used in a month. The function should also calculate the average cost per hour of the time used (rounded to the nearest 0.01), so use two output parameters to send back these results. You should write a second function round_money that takes a real number as an input argument and returns as the function value the number rounded to two decimal places. Write a main function that takes data from an input file usage.txt and produces an output file charges.txt. The data file format is as follows: Line 1: current month and year as two integers Other lines: customer number (a five-digit number) and number of hours used Here is a sample data file and the corresponding output file:…arrow_forward(Wattan Corporation) is an Internet service provider that charges customers a flat rate of $7.99 for up to 10 hours of connection time. Additional hours or partial hours are charged at $1.99 each.Write a function charges that computes the total charge for a customer based on the number of hours of connection time used in a month. The function should also calculate the average cost per hour of the time used (rounded to the nearest 0.01), so use two output parameters to send back these results.You should write a second functionround_money that takes a real number as an input argument and returns as the function value the number rounded to two decimal places. Write a main function that takes data from an input file usage.txt and produces an output file charges.txt. The data file format is as follows:Line 1: current month and year as two integersOther lines: customer number (a five-digit number) and number of hours usedHere is a sample data file and the corresponding output file:Data file…arrow_forward
- (C PROGRAMMING ONLY) 4. Special Exchanging Giftsby CodeChum Admin It's Christmas time and we're having this exchanging gifts activity! I want to surprise the receiver of my gift. After he/she receives my gift, I will add an additional P100 bill! Instructions: In the code editor, you are provided with a main() function that asks the user for 2 integers. Then, a function call to a function named, exchangeGift() is made and the addresses of the 2 integers are passed.This exchangeGift() function hasn't been implemented yet so this is your task. This has the following description:Return type - voidName - exchangeGiftParameters - 2 addresses of 2 integersDescription - swaps the value of the 2 integers and then adds 100 to the 2nd integer (or 2nd parameter)DO NOT EDIT THE MAINInput 1. First integer 2. Second integer Output Enter·integer·1:·10Enter·integer·2:·2020·110arrow_forward(C PROGRAMMING ONLY) 2. Odd Lifeby CodeChum Admin In life, anything can happen. Yesterday we're happy, tomorrow we're sad. One moment we're up, the next we're down. Life's odd. But that's what makes it beautiful ? In this program, let's try displaying all the odd numbers of our array, life, but with the use of functions! Instructions: In the code editor, you are provided with an array called, life. Furthermore, in the main(), a function call was made to the function displayOdd() where the array life was passed as well as the size of life which is 90.Your task is to declare and define the function displayOdd() which has the following details:Return type - voidName - displayOddParametersint* - an arrayint - the size of the arrayDescription - displays all the odd numbers found in the array passed, starting from the end. Output Odd element at index 80: 33Odd element at index 77: 69Odd element at index 76: 17Odd element at index 73: 15Odd element at index 69: 101....arrow_forward(C PROGRAMMING ONLY) DO NOT EDIT THE MAIN 7. Special Exchanging Giftsby CodeChum Admin It's Christmas time and we're having this exchanging gifts activity! I want to surprise the receiver of my gift. After he/she receives my gift, I will add an additional P100 bill! Instructions: In the code editor, you are provided with a main() function that asks the user for 2 integers. Then, a function call to a function named, exchangeGift() is made and the addresses of the 2 integers are passed.This exchangeGift() function hasn't been implemented yet so this is your task. This has the following description:Return type - voidName - exchangeGiftParameters - 2 addresses of 2 integersDescription - swaps the value of the 2 integers and then adds 100 to the 2nd integer (or 2nd parameter)DO NOT EDIT THE MAINInput 1. First integer 2. Second integer Output Enter integer 1: 10Enter integer 2: 2020 110arrow_forward
- ( C PROGRAMMING ONLY) 5. Simplicity is Beautyby CodeChum Admin In life, simplicity is beauty. Let's try creating something so simple. Let's create a function that accepts the address of an integer and prints n number of asterisks out of it. For example, if the value of the address passed is 5, then the output would be five asterisks in one line. Instructions: In the code editor, you are provided with a main() function that asks the user for an integer and passes the address of this integer to a function call of the simple() function.This simple() function hasn't been implemented yet so your task is just that, to implement it. This has the following description:Return type - voidName - simpleParameter - address of an integerDescription - prints a line of asterisksDO NOT EDIT THE MAIN FUNCTIONInput 1. An integer Output Enter·n:·5*****arrow_forward(Use Python) Use the Design Recipe to define a function called bee_bop that consumes an integer called num. The function prints each number from 1 to num (exclusive) on a new line. For each multiple of 2, print "bee" instead of the number. For each multiple of 3, print "bop" instead of the number. For numbers which are multiples of both 2 and 3, print "bee-bop" instead of the number. For example: Test Displays bee_bop(13) 1beebopbee5bee-bop7beebopbee11bee-boparrow_forward(C PROGRAMMING ONLY) 1. Pointing Fingersby CodeChum Admin I am so mad at my brothers, they always point their fingers to me whenever mom gets angry ? Now that I'm knowledgeable about pointers, I'm going to point all of my 5 fingers to them. Let's see who's tough now! Instructions: In the code editor, you are provided with a main() function where the user is asked for 5 double numbers.Then, in lines 19 - 23, your task is to set the addresses of these numbers to each of the pointers. The address of the first number, a, should be assigned to the first pointer, the address of the second number, b, should be assigned to the second pointer, and so on.Input 1. First number 2. Second number 3. Third number 4. Fourth number 5. Fifth number Output Enter 1st number: 23.2Enter 2nd number: 10.01Enter 3rd number: 800Enter4th number: 24Enter 5th number: 2123.2 10.0 800.0 24.0 21.0arrow_forward
- (C PROGRAMMING ONLY) 2. Pairing Upby CodeChum Admin You’re tasked with pairing up people with each other but you need to figure out how well both of them work together. In order to find out how effective each pair is, you need to create a program that adds both of their values and returns their sum. Instructions: In the code editor, you are provided with a main() function that asks the user for two integer inputs, passes these to a function called, getSum(), and then prints the returned value.Your task is to declare and define the getSum() function which has the following details:Return type - intName - getSumParameters - 2 integersDescription - adds the passed integers and returns their sumDO NOT EDIT ANYTHING IN THE MAINInput 1. First integer 2. Second integer Output Enter first number: 24Enter second number: 21Sum = 45arrow_forward(C PROGRAMMING ONLY) 2. Weird Treasure Chestby CodeChum Admin I'm now in the middle of the jungle when I saw this weird treasure chest. It seems that if I properly place the address of a certain number, I get a very weird result! Instructions: In the code editor, you are provided with a treasureChestMagic() function which has the following description:Return type - voidName - treasureChestMagicParameters - an address of an integerDescription - updates the value of a certain integer randomlyYou do not have to worry about how the treasureChestMagic() function works. All you have to do is ask the user for an integer and then call the treasureChestMagic() function, passing the address of that integer you just asked.Finally, print the updated value of the integer inputted by the user.Input 1. An integer Output Enter n: 10Treasure Chest Magic Result = 13arrow_forward(python) Speed of Sound is a constant 343 m/s Create a function that will return the Frequency Heard based on the above equation. The function should accept the following parameters: speed of sound, velocity of receiver, velocity of source and frequency of source. Make sure to prompt the user for the input data and call the function. Example Values/Results: Frequency of Source: 935 HzVelocity of receiver: 24 m/sVelocity of source 43 m/sHeard frequency is 888.977 Hzarrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Boolean Algebra - Digital Logic and Logic Families - Industrial Electronics; Author: Ekeeda;https://www.youtube.com/watch?v=u7XnJos-_Hs;License: Standard YouTube License, CC-BY
Boolean Algebra 1 – The Laws of Boolean Algebra; Author: Computer Science;https://www.youtube.com/watch?v=EPJf4owqwdA;License: Standard Youtube License