Question: Debug the program for me Please! This is my code: #include using namespace std; double InflationRate(float old_cpi, float new_cpi); int main() //C++ programs start by

Debug the program for me Please! This is my code: #include usingDebug the program for me Please!

This is my code:

#include using namespace std;

double InflationRate(float old_cpi, float new_cpi);

int main() //C++ programs start by executing the function main { // TODO #1: declare two float variables for the old consumer price index (cpi) and the new cpi float old_cpi, new_cpi, rate; // TODO #2: Read in two float values for the cpi and store them in the variables cout > old_cpi >> new_cpi; // TODO #3: call the function InflationRate with the two cpis rate = InflationRate(old_cpi, new_cpi); // TODO #4: print the results cout

double InflationRate(float old_cpi, float new_cpi) { double results; if (old_cpi > 0 && new_cpi > 0) { results = (new_cpi - old_cpi) / old_cpi * 100; return results; } return 0; }

// T7ODO #3: call the function InflationRate with the two cpi

rate = InflationRate(old_cpi, new_cpi);

// TODO #4: print the results

cout > repeat; } while (repeat == 'y' || repeat == 'Y');

// BONUS #2: Keep a running total of the valid inflation rates and the number of computed rates to calculate the average rate. // Print the results after the loop avg = sum / count; cout

double InflationRate(float old_cpi, float new_cpi) { double results; if (old_cpi > 0 && new_cpi > 0) { results = (new_cpi - old_cpi) / old_cpi * 100; return results; } return 0; }

The 2nd half of the code needs debugging

O Mimi DL X #include Using Namespace x M (no subject) - acwad.soutav + 2 X pa 01 Inflation Rale Part2 - Mini X | Get Homework Help With x elegant-saxnot.ide.mimir.io * M File File Mimir Mimir View Tools View Tools Find Help Upload Submit AZWAD SOURAV >> term3 x InflationRate.cpp:43:1: error: 'cin' does not name a type; did you mean 'main'? cin >> ropeat; main InflationRate.cpp:44:1: error: expected declaration before '1' token while (repeat -- 'y' || ropcat. == 'Y'); user@mimir: -/2000_csii sp21/00 inflationrate parti > ls a.out InflationRale.cpp azerlemimir: -/2000_csii_=p21/00_inflationrate_partl > g++ Inflation ate.cpp InflationRate.cpp:33:5: error: 'rate' docs not. nam a type; did you mean 'rand' 2 rate - InflationRate (old cpi, new cpi); Files G+ Inflation Rate.cpp 31 // TODO #3: call the function InflationRate with the two cpis 32 33 rate = InflationRate(old_cpi, new_cpi); 34 35 // TODO #4: print the results 2000_csii_sp21 36 37 cout > repeat; grade.cpp 44] 45 while (repeat -- 'y' || repeat -- 'Y'); bash_history 46 bashrc 47 // BONUS #2: Keep a running total of the valid inflation rates and the number of computed rates to calculate the average rate. 0 .profile 48 // Print the results after the loop .viminfo 49 avg - sum / count; 58 G cookie.cpp cout 0 && new_cpi > 0) untitled 58.[ 59 results - (new cpi - old_cpi) / old_cpi . 108; 68 return results; 61 1 rand InflationRate.cpp:37:9: error: 'cout' does not name a type cout > repeat; InflationRate.cpp:44:1: error: expected declaration before 'j' token } usermimir: -/2000_csii sp21/00_inflationrate_part1 > H Type here to search O 9 Com CO 9:42 PM 2/10/2021 99+

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!