Hi there. I was making a program which emulates a bank account of sorts using classes.
In this section of the code, however, I get an error for trying to enter Name[i]which is the same as I have given in my post title. The specifications of the class are as follows -:Code:void Account :: Start() { Account Temp; int i; for(i = 0; i < 3; i++) { Balance[i] = 0; cout << "\nEnter Account Number for User " << (i+1) << " : "; cin >> ACNo[i]; cout << "\nEnter Name of User " << (i+1) << " : "; cin.ignore(); cin.getline(Name[i], 50); cout << "\nEnter Account Type(S = Savings, C = Current) for User " << (i+1) << " : "; cin >> ACType[i]; } }
I gather Name[i] is wrong anyway as i goes uptill only 3.Code:const int n = 50; class Account { private: char Name[n]; int ACNo[n]; char ACType[n]; float Balance[n]; public: void Start(); void Deposit(); void Withdraw(); void Display(); };
Is there a way to get around these complications?



LinkBack URL
About LinkBacks



