Treskom was hired by the previous government to account for


PROBLEM

TresKom was hired by the previous government to account for expenses in the Choliseo VIP lounge. The new government of the republic, made up of engineers with impeccable behavior wants to improve the code of TresCom engineers. However, the TresCom engineers were so inept that they did not create functions and put all the code in the main. We hope you do the work as it should have been done in the beginning!

1. Move lines 11 to 14 to a function that will be called verificaMemory.

2. Move lines 16 to 20 to a function that will be called readComilona (keywords: comilona = abundant food accompanied with expensive wines and incredible desserts. Corrupt = politician).

3. Move lines 22 to 27 to a function that will be called PrintComilonayTotal.

4. In the PrintComilonayTotal function, in addition to printing the comilonas, you must calculate and print also the total amount of money spent on the comilonas (the total).

CODE

//3Com.Enaudi.inc todos los torcidos corruptados
#include
#include
using namespace std;
int main(){
float *gastos;
int numOfgastos;
cout << "Entre el numero total de fiestas: ";
cin >> numOfgastos;
gastos = new float[numOfgastos];
if (gastos == NULL){
cout << "Eror allocating memory, bye!!!";
return -1;
}
cout << "Entre la factura de su comilona corrupta\n";
for (int i = 0; i < numOfgastos; i++){
cout << "Leyendo Comilona " << i + 1;
cout << " en posicion de memoria: " << gastos + i << " : ";
cin >> *(gastos + i);
}
//Display gastos to verify they are inside the computer
for (int i = 0; i < numOfgastos; i++) {
cout << "\nComilona numero " << i + 1;
cout << " en direccion de memoria: " << gastos + i;
cout << " con valor de: ";
cout << *(gastos + i);
}
delete[] gastos;
return 0;
}

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Treskom was hired by the previous government to account for
Reference No:- TGS02898544

Expected delivery within 24 Hours