Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Macroeconomics Expert

Create and input and output file

(a) Write a function called readdata() which receives two parameters, an integer n and an array of integers called vals, both of which are changed in the function. The function reads a value into n and reads in n integers, storing the data values in the array vals. Print the data values as they are read in.

(b) Write a function called countzeros() which receives two parameters, an integer n and an array vals. The function counts how many of the first n elements of the vals array are 0. Print the number of 0 values (in either the main program or the function).

For example, if the array holds 66 0 -4 0 4 31 with n = 6, it has two 0 values.

(c) Write a function called append() which reads in several new values into the array, putting them at the end. As a result, it must change both the array and the value of n. The function receives the same two parameters as readdata(). Assume the array initially holds 66 0 -4 0 4 31 with n = 6; after the function call, the array might hold 66 0 -4 0 4 31 22 0 49 with n = 9.

(d) Write a main program which calls these functions. First, the main program calls readdata() to read a set of data into an array called numbers, which contains no more than 100 integers. The number of elements actually read is returned by the function and stored in a variable called size. Then the main program calls the function countzeros() to find how many of the size array elements are 0. Next the main program calls append() to modify the numbers array and n. The append() function reads in new values until input failure, adding the new values to the array and incrementing n. The new values in the array are printed (in either the main program or the function). Finally, the main program calls the function countzeros() again to determine how many elements in the new array are 0.

Macroeconomics, Economics

  • Category:- Macroeconomics
  • Reference No.:- M91934530
  • Price:- $20

Priced at Now at $20, Verified Solution

Have any Question?


Related Questions in Macroeconomics

Questions - 1 explain briefly about management

Questions - 1. Explain briefly about Management Competencies. 2. Explain briefly "Management Challenges in the Global Enterprise". 3. How to develop "High Performance Teams"? 4. Draw a "Motivation Model". What the best w ...

Question 1what is the current state of the us government

Question: 1. What is the current state of the U.S. government budget? 2. How do fiscal policy decisions made by the government impact the budget balance? 3. How do fiscal policy decisions made by the government impact th ...

Question explain these questionscompare the marginal

Question: Explain these questions Compare the Marginal Revenue Curve for a firm in the PC-market with the Marginal Revenue Curve for the monopolist. Explain in your own words why a company that creates a negative externa ...

Quesiton due to low unemployment firms are having tougher

Quesiton: Due to low unemployment, firms are having tougher time to find qualified workers. What will be the slope of aggregate supply curve if a country runs out of qualified workers to hire? The response must be typed, ...

Question positions on whether the constitution should be

Question: Positions on whether the Constitution should be amended to require a balanced budget reflect opposing views about whether such an amendment would be an appropriate solution to the problem of persistent federal ...

Question - suppose that a consumer can earn a higher wage

Question - Suppose that a consumer can earn a higher wage rate for working overtime. That is, for the first q hours the consumer works, he or she receives a real wage rate of w1, and for hours worked more than q he or sh ...

Discussion questionsquestion 1 what are the main reasons

Discussion Questions Question 1: What are the main reasons why Nigerians living in extreme poverty? Justify. ( 7) Question 2: Why GDP per capita wouldn't be an accurate measure of the welfare of the average Nigerian? Exp ...

Question - feldstein 2012 indicates that the hospital is

Question - Feldstein (2012) indicates that the hospital is the most important institutional setting for the delivery of medical services because it represents "the largest single health care expenditure category," and it ...

Question president trump has proposed a lowering of the

Question: President Trump has proposed a lowering of the corporate income lax rale from 35% to 15% and the top personal income tax rate from 39.6% to 15%. When lie unveiled the tax plan. Treasury Secretary Steven Mnuchin ...

Question - a 1000 utility bond with 14 years remaining

Question - A $1000 utility bond with 14 years remaining before maturity can now be purchased for $760. It pays interest of $20 each 6-month period. What rate of return is earned by purchasing the bond at the current mark ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As