I have been given an assignment from my uni to create a bank where im to have customers with multiple accounts and different account types, also then add other things like loans etc.
Im having problems getting a linked list to work with the class objects. my aim is to store all the customers details, and account details in the class objects then list all the customers in the linked list instead of using something like an array as we get more marks for using linked lists.
so far i have managed to get it so the customer can be created and pointing to just one account. but i am stuggling with understanding how im to then create the linked list so it connects to the class object.
these are some bits of the code which i have so far:
with this im not sure if im doing it the correct way, but am i to create the objects then pass in the refference to it, which is then stored in the linked list?
CustomerList.cpp
#include "CustomerList.h"
#include <iostream>
using namespace std ;
CustomerList::CustomerList()
{
front = back = 0;
}
bool CustomerList::isEmpty()
{
return front == 0;
}
void CustomerList::addCustomer(Customer *tempCustomer)
{
Node* insert = new Node(tempCustomer);
if (front == 0)
{
back = front = insert;
}
else
{
back-> next = insert ;
back = back -> next ;
}
}
CustomerList::removeCustomer()
{
Customer tempCustomer; Node* temp;
if (front != 0)
{
tempCustomer = front -> customerRef;
temp = front;
front = front -> next ;
delete temp ;
if (front == 0) back = 0;
return tempCustomer;
}
else return '\0';
}
CustomerList::~CustomerList()
{
Node * temp;
while(front != 0)
{
temp = front;
front = front -> next;
delete temp;
}
}
void CustomerList::print()
{
Node * temp = front;
if (temp != 0 )
{
while (temp != 0)
{
cout << temp -> customerRef.getName() ;
temp = temp -> next;
}
}
else cout << "empty";
cout << endl;
}
I'm gonna take the bait but here we go:
It's closed source as far as Linux goes but it is not locked to the Steam as a gaming platform. Yes, you need a Steam account to start using SteamOS, but after that you can use whatever Linux compatible launcher you want, ie Heroic or Lutris
It doesn't need an antivirus, it's Arch Linux. Anticheats work, depending on the game and publisher. Many games with EAC work. None with kernel level malware anticheat work, and they should NOT work on Windows either (MS really needs to block this).
It is compatible with Linux applications, Flatpak applications. You can also enable regular Pacman/AUR yourself. It's disabled, not removed, out of the box to protect the OS from you
But surely you do know you don't have to use SteamOS on the Steam Deck, right?
I like Neowin a lot, but this "article" is shady and misleading.
We need an "editorial" flag and this isn't "news" it's "my cousin's dog's best friend posted on twitter about their snapchat account from their dog's owner that a bad thing happened, so it's NEWS."
Thanks
Question
soil
I have been given an assignment from my uni to create a bank where im to have customers with multiple accounts and different account types, also then add other things like loans etc.
Im having problems getting a linked list to work with the class objects. my aim is to store all the customers details, and account details in the class objects then list all the customers in the linked list instead of using something like an array as we get more marks for using linked lists.
so far i have managed to get it so the customer can be created and pointing to just one account. but i am stuggling with understanding how im to then create the linked list so it connects to the class object.
these are some bits of the code which i have so far:
AssignmentBank.cpp (main)
with this im not sure if im doing it the correct way, but am i to create the objects then pass in the refference to it, which is then stored in the linked list?
CustomerList.cpp
CustomerList.h
any help at all would be useful.
I have gone to extra classes at uni and asked lecturers over and over but they dont seem to be helping me much.
Link to comment
https://www.neowin.net/forum/topic/955220-c-linked-list-and-objects/Share on other sites
7 answers to this question
Recommended Posts