Question
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
using namespace std;
//template
struct Account{ int accountNumber; string lastName; string firstName; double accountBalance; }; vector
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
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() {
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
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