C++ for Engineers and Scientists
C++ for Engineers and Scientists
4th Edition
ISBN: 9781133187844
Author: Bronson, Gary J.
Publisher: Course Technology Ptr
Question
Book Icon
Chapter 4.5, Problem 1E
Program Plan Intro

Program plan:

  1. The variable num of type int is declared to store the entered number.
  2. A if statement is used to check the values of num for negative and zero values.
  3. An inbuilt function sqrt() is used to calculate the square root of the number.
  4. To calculate the reciprocal of num is divided by 1.0.

Program description:

The main purpose of the program is used to calculate the square root and reciprocal of a number.

Blurred answer
Students have asked these similar questions
(C PROGRAMMING ONLY) 7. Comparing Charactersby CodeChum Admin Most, if not all things have numeric values. That goes for characters too. In order to find out which character has a higher value, we have to compare them with each other and display the value of the higher character.   Instructions: In the code editor, you are provided with a main() function that asks the user for 2 characters, passes these characters to a function call of the getHigherValue() function, and then prints out the ASCII value of the higher character.Your task is to implement the getHigherValue function which has the following details:Return type - intName - getHigherValueParameters - 2 characters to be comparedDescription - the ASCII value of the higher character.Hint: Comparing characters in C is just like comparing integers.DO NOT EDIT ANYTHING IN THE MAINInput 1. First character 2. Second character Output Enter first character: aEnter second character: hResult value = 104
(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.
(25 min) The following table shows the foreign exchange rates for a few currencies. Foreign Currency RM USD (D) 1 Dollar 4.16 GBP (P) 1 Pound 5.68 KRW (W) 1000 Won 3.51 JPY (Y) 100 Yen 3.69 Develop a complete C++ program that will prompt the user to enter the currency preferred and the amount required. The program should include a function with the following prototype: double CurrencyBuy(char, double): The first parameter in the function prototype is for the type of currency where the characters D, P, W and Y represent Dollar, Pound, Won and Yen respectively. The second parameter is the amount to be bought. This function CurrencyBuy should return, to the calling function, the payment to be paid in RM. A sample of the output is given as follows. Foreign Exchange Currency Country Code USD (D) GВР (Р) KRW (W) JPY (Y) Enter the country code: D Enter the amount to be bought: 300 Payment due is RM 1248.
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education