Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Attempting to make a bank program which stores bank accounts, allows for withdrawal/deposit of money, and each account has a first/last name associated. Getting a

Attempting to make a bank program which stores bank accounts, allows for withdrawal/deposit of money, and each account has a first/last name associated. Getting a lot of scope errors, and I'm very confused with structure and templates across multiple files. I mainly just want to get the thing working so that I can start making an account and getting inputs. Thanks.

Here is the main.cpp file:

#include #include #include #include #include "header_file.h"

using namespace std;

//template //where should this and the prototype go? //void makeAccount(vector &);

struct Account{ int accountNumber; string lastName; string firstName; double accountBalance; }; vector bankAccounts;

int main() { // declare list of account here. The size of the list is not fixed. int input = 0; int *inputPtr = &input; while(input != 6) { menu(inputPtr); // run loop to continue program until terminated by user

switch (input) { //cases: call functions to perform tasks case 1: makeAccount(typeStruct>&)); break;

/* case 2: PrintAllAccount(); break;

case 3: depositAccount(); break;

case 4: withdrawAccount(); break;

case 5: printAccount(); break;*/

case 6: break; } } return 0; }

function_file.cpp file:

// function_file.cpp #include "header_file.h" #include #include #include #include #include #include #include

int deposit; int number = 0; int deleteChoice = 0; int choice; int accounts = 0;

using namespace std;

void menu(int *num) {

int select = 0; cout << "Welcome to Made_up Banking. Select options below:" << endl; cout << "\t1. Make new account." << " \t2. Display all accounts." << " \t3. Deposit to an account." << " \t4. Withdraw from an account." << " \t5. Print account." << " \t6. Quit." << endl; cout << "Selection:\t"; cin >> select; *num = select; } template void makeAccount(vector &); Account a;

void makeAccount() {

static int accountNumber = 12050; string lastName; string firstName; double accountBalance;

a.accountNumber = ++accountNumber;

cout << "Enter first name:" << endl; cin >> a.firstName;

cout << endl << "Enter last name:" << endl; cin >> a.lastName;

cout << endl << "Enter account balance:" << endl; cin >> a.accountBalance;

//bankAccounts.push_back(a);

//Account.accountNumber = ++accountNumber

}

header_file.h file:

// header_file.h # include using namespace std; void menu(int*); void makeAccount(); void printAccount(); void PrintAllAccount(); void depositAccount(); void withdrawAccount(); void sortAccounts(); // sort the accounts using the account numbers void deleteAccount();

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases On The Web Designing And Programming For Network Access

Authors: Patricia Ju

1st Edition

1558515100, 978-1558515109

More Books

Students also viewed these Databases questions

Question

Determine the roles of spatial layout and functionality.

Answered: 1 week ago

Question

Be familiar with the basic ways to manage capacity.

Answered: 1 week ago