C++ How to Program (10th Edition)
C++ How to Program (10th Edition)
10th Edition
ISBN: 9780134448237
Author: Paul J. Deitel, Harvey Deitel
Publisher: PEARSON
Question
Book Icon
Chapter 6, Problem 6.37E
Program Plan Intro

Program Plan:

  • In the program, we include the header files as needed.
  • Function prototype will be declared.
  • Declaring main() function as integer type.
  • Variable declaration : varialesnum_series,iloopare user defined numbers declared as integer type in the main(). The variable num_seriescarried with the non_recursive_fibonacci_series().
  • user_series is a variable declared as integer type declared in non_recursive_fibonacci_series() function to carry the user input to the function.
  • Calling the non_recursive_fibonacci_series() in the main().
  • non_recursive_fibonacci_series() :this function will help to find out the Fibonacci numbers.
  • Declaring the variables the_start_fib_num, the_second_fib_num,the_next_fib_num as integer type andinitializing the variables with 0,1,0 respectively to avoid garbage value.
  • non_recursive_fibonacci_series() function returns the result.

Blurred answer
Students have asked these similar questions
B. Using Algebraic manipulation, simplify the following function. H(A.B,C,D)=( B + C )(A + D ) + D (AC+AB)
(Recursive Greatest Common Divisor) The greatest common divisor of integers x and y isthe largest integer that evenly divides both x and y. Write a recursive function gcd that returns thegreatest common divisor of x and y. The gcd of x and y is defined recursively as follows: If y is equalto 0, then gcd(x, y) is x; otherwise gcd(x, y) is gcd(y, x % y), where % is the remainder operator.
Redo the program given where you have to define and use the following functions: (a) isTriangle - takes 3 sides of a triangle and returns true if they form a triangle, false otherwise. (b) isIsosceles - takes 3 sides of a triangle and returns true if they form an isosceles triangle, false otherwise. (c) isEquilateral - takes 3 sides of a triangle and returns true if they form anequilateral triangle, false otherwise. (d) isRight - takes 3 sides of a triangle and returns true if they form a right triangle, false otherwise. (e) your program should run continuous until the user wants to quit The given program: #include <iostream> #include <cmath> using namespace std; // Constant Declarations const double E = .0001; int main() { double side1, side2, side3; bool isTriangle, isRight, isEquilateral, isIsosceles; cout << "Enter the lengths of the 3 sides of a triangle -- "; cin >> side1 >> side2 >> side3; isTriangle = side1 + side2 > side3 &&side1…

Chapter 6 Solutions

C++ How to Program (10th Edition)

Ch. 6 - Prob. 6.21ECh. 6 - Prob. 6.22ECh. 6 - Prob. 6.23ECh. 6 - (Separating Digits) Write program segments that...Ch. 6 - (Calculating Number of Seconds) Write a function...Ch. 6 - (Celsius and Fahrenheit Temperature) Implement the...Ch. 6 - (Find the Minimum) Write a program that inputs...Ch. 6 - Prob. 6.28ECh. 6 - (Prime Numbers) An integer is said to be prime if...Ch. 6 - Prob. 6.30ECh. 6 - Prob. 6.31ECh. 6 - (Quality Points for Numeric Grades) Write a...Ch. 6 - Prob. 6.33ECh. 6 - (Guess-the-Number Game) Write a program that plays...Ch. 6 - (Guess-the-Number Game Modification) Modify the...Ch. 6 - Prob. 6.36ECh. 6 - Prob. 6.37ECh. 6 - Prob. 6.38ECh. 6 - Prob. 6.39ECh. 6 - Prob. 6.40ECh. 6 - Prob. 6.41ECh. 6 - Prob. 6.42ECh. 6 - Prob. 6.43ECh. 6 - Prob. 6.44ECh. 6 - (Math Library Functions) Write a program that...Ch. 6 - (Find the Error) Find the error in each of the...Ch. 6 - (Craps Game Modification) Modify the craps program...Ch. 6 - (Circle Area) Write a C++ program that prompts the...Ch. 6 - (pass-by-Value vs. Pass-by-Reference) Write a...Ch. 6 - (Unary Scope Resolution Operator) What’s the...Ch. 6 - (Function Templateminimum) Write a program that...Ch. 6 - Prob. 6.52ECh. 6 - (Find the Error) Determine whether the following...Ch. 6 - (C++ Random Numbers: Modified Craps Game) Modify...Ch. 6 - (C++ Scoped enum) Create a scoped enum named...Ch. 6 - (Function Prototype and Definitions) Explain the...Ch. 6 - Prob. 6.57MADCh. 6 - Prob. 6.58MADCh. 6 - (Computer-Assisted Instruction: Monitoring Student...Ch. 6 - (Computer-Assisted Instruction: Difficulty Levels)...Ch. 6 - (Computer-Assisted Instruction: Varying the Types...
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning