Issue with how to properly use push_front and pop_front.
I have a class named
Account
I am suppose to be able to be able to add new accounts and new balances but I can't find the proper documentation on how to do this. I am trying to figure out what do I put in my header file in the class declaration, what to put in the .cpp file and what to put in the main.cpp file.
Below are some excerpts from my code,
//Header file
#ifndef ACCOUNT_H
#define ACCOUNT_H
#include <string>
using namespace std;
class account
{
public:
//default constructor
account();
//constructors
account(string, double);
//Account - Sets up an account given an account number
// with zero balance.
//@param int - The account number.
void setName(string);
void setBalance(double);
/***********************.cpp file
#include "account.h"
#include <iostream>
account::account()
{
accountName = "";
balance = 0.0;
}
account::account(string newAccountName, double newBalance)
{
accountName = newAccountName;
balance = newBalance;
}
void account::setName(string newAccountName)
{
accountName = newAccountName;
}
void account::setBalance(double newBalance)
{
balance = newBalance;
}
string balance::getName() const
{
return accountName;
}
/************ main.cpp file
#include "account.h"
#include <iostream>
#include <list>
using namespace std;
int main()
{
string name;
double balance;
cout << "***************************************…
<< "\tAccount Class Tester\n"
<< "***************************************…
//Create an account for Bob Peterson.
//Bob has no initial balance.
account accountList ("Bob", 111);
cout << "Enter the account's name\n";
cin >> name;
accountList.setName(name);
cout << "New name: " << accountList.getName();
cout << "\n\nEnter the account's balance\n";
cin >> balance;
accountList.setBalance(balance);
cout << "New balance: " << accountList.getBalance();
*******************************
So right now I have the user enter in the information but what I suppose to do is to use the following list objects
push_front
pop_front
front
The issue I am running into is I don't know how to properly declare these within the class declaration, .cpp file and main.cpp file Any help would be great. Thanks