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
Dialogue is not a characteristic of functional text because...
kumpel [21]
It is b,<span>dialogue it's speech between characters, and there are no characters and functional text </span>
4 0
3 years ago
What is a guardian node summary for theta staking tool
Diano4ka-milaya [45]

Answer: Theta Guardian

Explanation:

THETA is used to stake as a Validator or Guardian node, contributing to block production and the protocol governance of the Theta Network. By staking and running a node, users will earn a proportional amount of the new TFUEL generated. Relayers earn TFUEL for every video stream they relay to other users on the network.

3 0
2 years ago
Choose the best answer from the options below to complete the following sentence.
Lemur [1.5K]

Answer:

its A. the answer to your question is preserved. :)

7 0
2 years ago
What are the elements of a good study environment? Check all that apply.
finlep [7]

The elements of a good study environment are that it must be well lit the resources are near it is quite and it is clutter free

Explanation:

A good study environment must be an environment that will promote the good study conditions and it must be quite and calm if a person studies in that environment all the resources like the food water and the other refreshments must be available in that environment

The environment must be clean and it must be clutter free without any disturbances and hence these are the factors that will promote the good study environment

3 0
3 years ago
Read 2 more answers
Before you insert a page break, what should you do? select the font you want to use for the text that comes after the page break
Triss [41]
Put the insertion point where you want the page to break is what I would write.
7 0
3 years ago
Other questions:
  • I need to write a program that accepts eight int values representing student test scores from the user and then displays each of
    14·1 answer
  • what evidence supports the claims that the Taj Mahal is a symbol of historical and cultural glory as well as an architectural ma
    8·1 answer
  • what is it called when you are biying and selling products via electronic channels such as the internet​
    13·2 answers
  • This activity will help you meet these educational goals:
    7·2 answers
  • Terms that represents the achual speed used by device to transfer data​
    14·1 answer
  • After reading the article, "The Impact of Technology", answer the following question.
    7·1 answer
  • What are the pros and cons of using a linked implementation of a sparse matrix, as opposed to an array-based implementation?
    11·1 answer
  • PLZ HELP FAST!!!! 
    7·2 answers
  • Write a program that takes in a positive integer as input, and outputs a string of 1's and 0's representing the integer in binar
    12·1 answer
  • What is a file path?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!