well i hope someone can help, i have written a program and i had to pass an array into a function and now i have a variable for the subscript of the array and i was the user to input data, specificlly a string, more specifically first and last name without having to create two arrays, i have to do this with other things in the program as well so if i can get help that would be awsome, here is part of the program:
int addFunc(const int totNum, string city[],string state[],string street[],string name[],
int addNum[],int zip[],int telNum[],double bal[],int dateLp[], int addCount, int accNum, int usNum)//function will add a new account
{
int countAf = 1;
if (usNum < 20)
{
while (addCount == 1) //ensures to loop if user wants to input another new account
{/*account account(usNum + 1);
account(usNum).*/
cout << "Add an account: " << endl<<"current account number is #"<<accNum<<"(save this number for reference)"<<endl;
cout << "1.Name: ";
cin>>name[usNum]; //this is the part im trying to do
it should be able to take firstname space lastname
thank you, i need to read on this some more, to expand on my issue, i am in a class and we are only part way through the book so i am still learning, i have actually spent many hours writing the who program and would like to try to finish it without re writing the whole program, it is overdue so this is not something that is possible for me anyways. How would i use that to read a subscript value? could you show exactly please and thank you very much, this part has been very tricky for me.
additionally i will have to do this with multiple arrays, to expand on the project, i need to write a program that will create users accounts with information, give an option to view the information for any user and edit it as well
Hey i actually see what your talking about now with a structure that uses arrays to store multiple instances of an account, based on the different customers, what would a basic set up look like if you dont mind showing me? thank you
int addFunc(constint totNum, string city[],string state[],string street[],string name[],
int addNum[],int zip[],int telNum[],double bal[],int dateLp[], int addCount,
int accNum, int usNum)//function will add a new account
{
int countAf = 1;
if (usNum < 20)
{
while (addCount == 1) //ensures to loop if user wants to input another new account
{/*account account(usNum + 1);
account(usNum).*/
cout << "Add an account: " << endl<<
"current account number is #"<<
accNum<<"(save this number for reference)"<<
endl;
cout << "1.Name: ";
getline(cin,name[usNum]); //Assuming <string> included