1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
AVprozaik [17]
2 years ago
9

Write a program that outputs inflation rates for two successive years and whether the inflation is increasing or decreasing. Ask

the user to input the current price of an item and its price one year and two years ago. To calculate the inflation rate for a year, subtract the price of the item for that year from the price of the item one year ago and then divide the result by the price a year ago. Your program must contain at least the following functions: a function to get the input, a function to calculate the results, and a function to output the results. Use appropriate parameters to pass the information in and out of the function. Do not use any global variables.
Computers and Technology
1 answer:
MrRissso [65]2 years ago
8 0

Answer:

#include

using namespace std;

void getInput(double currentPrice, double priceYear1, double priceYear2){

   cin >> currentPrice;

   cin >> priceYear1;

   cin >> priceYear2;

}

void printInflationRate( double myRate){

   cout<< "The inflation rate for the year price = "<< rate;

}

void calInflation(double targetPrice, double yearBefore){

   double rate = (yearBefore - targetPrice)/ yearBefore;

   printInflationRate( rate);

}

int main(){

   double cprice, year1price, year2price, rate;

   getInput(cprice, year1price, year2price);

   calInflationRate(cprice, year1price);

   calInflationRate(year1price, year2price);

   return 0;

}

Explanation:

The C++ program source code defines three void functions (functions with no return statement), 'calInflationRate', 'getInput', and printInflationRate. In the main program code, the four float point number variables are declared, and the getInput function assigns values to them. The calInflationRate function calculates the inflation rate of a given year, and it in, the printInflationRate is called to print the output on the screen.

You might be interested in
The website of an international human rights organization stores a large database of information and provides search functionali
ValentinkaMS [17]

Answer:

False.

Explanation:

The website of an international human rights organization stores a large database of information and provides search functionality to make it easier for their visitors to locate desired information. However, this approach fails to be effective since the search functionality is limited to the website rather than the whole web is a False statement.

3 0
3 years ago
Read the following scenario, and then answer the question below.
shtirl [24]
Establish what skills are required to reach his goal
8 0
2 years ago
Read 2 more answers
A campfire is a good source of heat and light on a cool night. The energy that is released when firewood is burned comes from th
Makovka662 [10]
Chemical reactions in the material used to make matches, and the cardboard... so hope this helps :)

NOTE: im not to good at this stuff so i rlllllly hope it helps























































3 0
3 years ago
What should you do in order to have access to the header and footer tools? Open the View tab. Open the Page Setup dialog box. Op
Svetach [21]

Answer:

Step 1  - Open the View tab.

Step 2 - Open the Page Setup dialog box

Step 3 - Open the header and footer tool.

Step 4 - Click OK.

Explanation:

In order to access to the header and footer tools

Step 1  - Open the View tab.

Step 2 - Open the Page Setup dialog box

Step 3 - Open the header and footer tool.

Step 4 - Click OK.

4 0
2 years ago
Nowadays computer games are mostly available on external<br> hard disk.<br> Is it true or false?
sergey [27]

Answer:

false

Explanation:

because a lot of times they are downloads without the disk

7 0
3 years ago
Read 2 more answers
Other questions:
  • You are given a network of 10.50.24.0/21, which contains 2,048 addresses. what subnet mask should you use to divide this into fo
    7·1 answer
  • What ipconfig command line option can be used to delete cached dns information from memory?​?
    9·1 answer
  • Which best describes obliteration in a forged document?
    11·1 answer
  • to see which employees received 3 or more bonuses. use the highlight cells rules conditional formatting to format cells in the r
    6·1 answer
  • If you have 60fps on your laptop tell me one way you can go to 240fps
    14·2 answers
  • Question 5 (frue/False Worth 3 points)
    7·1 answer
  • Hurry please i need this ASAP<br><br>What might be some advantages to keeping CSS and HTML separate?
    8·1 answer
  • What are the different Stape of data processing cycle?​
    8·1 answer
  • What is HTML? Write some future of HTML.<br>follow for follow ​
    15·2 answers
  • ________ is the actual speed of data transfer that is achieved between two nodes on a network and is always less than or equal t
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!