Question
PLEASE HELP ASAP C++ In the following program read the account number , account type (' c ' for Credit, ' d ' for Debit),
PLEASE HELP ASAP C++
In the following program read the account number, account type ('c' for Credit, 'd' for Debit), and deposit amount of a Customer from the console, and store the information in objects of type Customer.
Implement the global function read() to read customer information and store it in the Customer object and then implement another global function called display() to display the information stored in the Customer object.
Looking at the code in main(), note that the functions read() and display() receive Customer pointers as arguments.
Function definitions and statements in the main function are missing, which are marked byTODO.
Please complete the missing parts:
#include
#define NO_CUSTOMERS 3
using namespace std;
struct Customer {
int acc_no; // account number
char acc_type; // account type
double dep_amt; // deposit amount
};
// TODO-1: write implementation of function read()
// TODO-2: write implementation of function display()
int main()
{
struct Customer* cst;
// TODO-3: allocate memory pointed by cst to store total NO_CUSTOMERS objects
for (int i = 0; i < NO_CUSTOMERS; i++) {
read(&cst[i]);
}
for (int i = 0; i < NO_CUSTOMERS; i++) {
display(&cst[i]);
}
// TODO-4: free memory allocated
}
Input format:
Account no: 9999
Output format:
Account no: 99999Account type: Credit/Debit // print credit for c and debit for dDeposit amount: 999.99
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started