I was writting this code and now there is a very simple problem which is eating my brain cause i dont know what the hell is wrong with the code. when you compile and run the code choose option number 1, then enter your data, and exit the program. the output will be stored in a file called info.txt. the problem is that account holder name will not be stored and exactly was has been entered for account type will be stored as account holder name too and i really dont know why.
char Bank::acc_holder_name_f() // you return only a character
{
return acc_holder_name[50]; // 50 is out of bounds
// 49 is the last possible index because it starts with 0
}
what you want is this:
1 2 3 4
constchar *Bank::acc_holder_name_f()
{
return acc_holder_name; // This returns the string
}
I know playing "guess-the-error" is a lot of fun, but some of us are kinda busy. Perhaps you could, y'know, actually tell us what the error message is, rather than making us guess?
EDIT: Did you remember to change the method declaration in your class definition?