I was wondering is someone could help me with this problem. I am making a bank program and I need to assign each new customer an account number. The account number starts at 0011228x.
So first account number will be 00112281
Account 2 will be 00112282
and so on.
The problem I am having is if I make it an int, it does not accept the two 00 at start. If I make it a string it does not increment by 1. Any ideas how I can solve this?
Error message = E:\C++ Programs\Creating Account Number\Creates bank account number.cpp In function `std::string new_account_number2()':
Error message2 = 21 E:\C++ Programs\Creating Account Number\Creates bank account number.cpp `to_string' is not a member of `std'
Basically what I have done is every time an object is created "number_of_accounts_created" is incremented by 1 and then I use the member function "set_account_number" to create the new account number.
However, the problem I now have is it won't compile and I get the following message:
" [Linker error] undefined reference to `Customer::number_of_accounts_created' "
Do you know how I can fix this?
edit: I added my destructor as well but that still getting same message
edit 2: I realised I had not initialised the variable so got it working now.
> [Linker error] undefined reference to
> `Customer::number_of_accounts_created'
Defining Customer::number_of_accounts_created will make that error go away.
> Basically what I have done is every time an object is created
>"number_of_accounts_created" is incremented by 1 and then I use the
> member function "set_account_number" to create the new account number.
What would happen if an anonymous temporary object is created and destroyed?