Create a vector of Fibonacci numbers and print them using the function from exercise 2. To create
Question:
Create a vector of Fibonacci numbers and print them using the function from exercise 2. To create the vector, write a function, fibonacci(x,y,v,n), where integers x and y are ints, v is an empty vector, and n is the number of elements to put into v; v[0] will be x and v[1] will be y. A Fibonacci number is one that is part of a sequence where each element is the sum of the two previous ones. For example, starting with 1 and 2, we get 1, 2, 3, 5, 8, 13, 21, . . . . Your fibonacci() function should make such a sequence starting with its x and y arguments.
Data from Exercise 2
Write a function print() that prints a vector of ints to cout. Give it two arguments: a string for “labeling” the output and a vector.
Step by Step Answer:
Students also viewed these Computer science questions
-
For a 3 by 3 magic square, how can you determine the sum of the numbers in any particular row, column, or diagonal by using a key value in the magic square? Use the three magic squares illustrated to...
-
Create an inheritance hierarchy that a bank might use to represent customers bank accounts. All customers can deposit (credit) into their accounts and withdraw (debit) from their accounts. More...
-
Part 1 of the Final Project, due at the end of this unit, requires you to describe and draw a flowchart of the sales or purchasing process at your organization (or one of your choice). This...
-
Evenflow Power Co. is considering a new project that is a little riskier than the current operations of the company. Thus, management has decided to add an additional 1.5% to the company's overall...
-
The clerks of the traffic courts at three neighboring towns keep track of the number of miles by which convicted speeders drive over the speed limit. The data, which are approximately normally...
-
A tank in a room at 19C is initially open to the atmosphere on a day when the barometric pressure is 102 kPa. A block of dry ice (solid CO 2 ) with a mass of 15.7 kg is dropped into the tank, which...
-
Use a dot plot to organize the data set in Example 1. Describe any patterns. Data from Example 1 The data set at the left lists the numbers of text messages sent in one day by 50 cell phone users....
-
Miriam is a self-employed computer consultant. Her business nets $120,000 annually and she takes $85,000 of the earnings in salary. Miriam is considering incorporating her computer consulting...
-
3. (50 points) You are given a function f(x) = sin(x) + cos(x) on the interval [-3,1] and you want to calculate the first derivative of this function at the points on this interval. Write a MATLAB...
-
Calculate the amount (in grams) C7BzO surfactant would need to be added to 10mL of 7M urea, 2M thiourea so that the C7BzO concentration is 1%. This solution is referred to as UTC7 Amount of C7BzO in...
-
How do we syntactically distinguish between a variable declaration and a variable definition?
-
Why cant you use the functions in the calculator program from Chapter 6 without declaring them first?
-
A study to determine the correlation between bank deposits and consumer price indices in Birmingham, Alabama, revealed the following (which was based on n = 5 years of data): a) What is the equation...
-
A company has the following results for its three most recent accounting periods: Trading profits/(losses) Chargeable gains Gift Aid donations y/e 31/5/16 59,700 8,400 1,000 eight months to 31/1/17...
-
A company has the following results for the three years to 31 May 2017: Trading profits/(losses) Gift Aid donations W/e 31/5/15 (32,200) 400 We 31/5/16 23,800 500 We 31/5/17 40,300 600 Assuming that...
-
PCC Ltd is a manufacturing company which prepares accounts to 31 December each year. The company made the following disposals of chargeable assets in the year to 31 December 2017: (i) On 12 September...
-
Glenda has been self -employed for many years, preparing accounts to 31 March each year. Her adjusted profits (after deduction of capital allowances) are currently running at approximately 80,000 per...
-
Andrew Pearson is a shareholder of Andrew (Nottingham) Ltd. Which of the following (if any) are his associates when deciding whether the company is a close company? (a) his sister (b) his...
-
What is data redundancy? explain why it is important in business information systems
-
Listed below are common types of current liabilities, contingencies, and commitments: a. Accounts payable b. Bank loans and commercial paper c. Notes payable d. Dividends payable e. Sales and excise...
-
When we say that the transport layer multiplexes and demultiplexes applicationlayer messages, do we mean that a transport-layer protocol can combine several messages from the application layer in one...
-
Distinguish between communication at the network layer and communication at the data-link layer.
-
Distinguish between a point-to-point link and a broadcast link.
-
Joey set up a lawn-mowing business in his neighborhood. He currently has 7 customers that want their lawns mowed each week, for which he charges $25.00 each. Joey spends $10.00 a week in gas and...
-
Vanessa has an outstanding bond with a 7.10 % semi-annual coupon and has 16 years left to mature. The current market rate is 10.50% per annum. What is the current yield of Vanessa's Bond.
-
Estimate the hydrogen consumption required to completely remove the sulfur from a hydrotreater feedstock and to reduce the nitrogen content of the product to 15 ppm by weight. The 48.5 API naphtha...
Study smarter with the SolutionInn App