Using c++ , Define a function named expenseReport. Use pointer notation instead
ID: 3689947 • Letter: U
Question
Using c++ , Define a function named expenseReport. Use pointer notation
instead of array notation in the implementation of the function.
The function declaration is as follows:
//*********************************************************************************************
// Function Name: expenseReport
//
// The function computes the average of the expenses stored in the input
// array parameter and displays a report of the expenses to the screen.
//
// Parameters:
// expenses - An array of double numbers
// count - An integer representing the number of expenses
// Returns:
// void
//*********************************************************************************************
Write a complete program to use this function. You need to use an
array of double numbers and initialize the array with the expense amounts.
The report should have all numbers aligned on the decimal points.
The report should look exactly as follows:
My Expense Report
=====================
1 45.25
2 49.38
3 12.75
4 123.50
5 8.25
6 19.95
7 145.70
Total 404.78
Average 57.83
Program template is as follows :
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
int foo (int *ptr, int size);
int main() {
return 0;
}
//*********************************************************************************
//* foo
//*
//* This function . . .
//*
//* Parameters:
//* ptr - describe the purpose of this parameter
//* size - describe the purpose of this parameter
//*
//* Returns:
//*
//* Describe the return value
//*
//*********************************************************************************
int foo (int *ptr, int size) {
// Write you code here . . .
return 0;
}
/*
Copy output of this program below this line.
--------------------------------------------
*/
Explanation / Answer
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
int foo (int *ptr, int size);
int main()
{
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.