#include <iostream> using namespace std; double calcSale(double *earn) { double
ID: 3840163 • Letter: #
Question
#include <iostream>
using namespace std;
double calcSale(double *earn)
{
double earning, profit = 325.70, *newsale ;
*earn = 7000;
earning = earn + profit;
newsale = earning;
return &newsale;
}
int main()
{
int income;
int sale = 4236;
income = calcSale(sale);
cout << "Your latest sale + profit now is : " << income << endl;
return 0;
}
/************************* LIST YOUR ERRORS HERE ****************************************/
// LINE NO CORRECTED CODES
// Error 1
// Error 2
// Error 3
// Error 4
// Error 5
Explanation / Answer
Please find my answer.
#include <iostream>
using namespace std;
double calcSale(double *earn)
{
double earning, profit = 325.70, *newsale ;
*earn = 7000;
earning = earn + profit;
newsale = earning;
return &newsale;
}
int main()
{
int income;
int sale = 4236;
income = calcSale(sale);
cout << "Your latest sale + profit now is : " << income << endl;
return 0;
}
// LINE NO CORRECTED CODES
// Error 1 6 *earn = 7000; Remove this line, it assign new value to earn
// Error 2 7 earning = *earn + profit;
// Error 3 8 newsale = earning; Remove this line, this in not required
// Error 4 10 return earning;
// Error 5 16 income = calcSale(&sale);
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.